如何将相对URL用于子树



我尝试使用相对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

将其添加为 subtree

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

子树没有与"孩子"存储库保持联系。相反,从存储库中的文件被读入,仅此而已。

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

最新更新