【问题标题】:How to use a relative url for subtrees?如何为子树使用相对 url?
【发布时间】:2017-06-06 22:21:27
【问题描述】:

我尝试使用相对 url 添加子树:

> git subtree add --prefix child ../child.git master --squash
git fetch ../child.git master
fatal: '../child.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

但是../child.git,相对于这个存储库的远程,一个我拥有完全权限的 git 存储库。如果我尝试将其添加为子模块,您会看到这一点:

> git submodule add ../child.git child
Cloning into 'D:/code/jjj/subtree/parent/child'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.

如果我使用绝对 URL,我可以将此子存储库添加为子树,如果我使用相对 URL,我可以将其添加为子模块。

我是否可以使用相对 URL 将其添加为 子树

【问题讨论】:

    标签: git git-subtree


    【解决方案1】:

    当我问这个问题时,我从根本上误解了子树。

    子树不保持与“子”存储库的连接。相反,来自 repo 的文件被读入,仅此而已。

    因此,使用相对路径没有任何意义或必要性。相反,应该使用绝对路径(如果使用 URL - 可以使用相对文件路径)。

    【讨论】:

      猜你喜欢
      • 2011-01-17
      • 2013-03-03
      • 1970-01-01
      • 2018-08-14
      • 2013-10-14
      • 2011-10-24
      • 1970-01-01
      • 2020-09-10
      • 1970-01-01
      相关资源
      最近更新 更多