[英]Inconsistent git submodule remote url
I have a git submodule:我有一个 git 子模块:
$ cd zathura
$ git remote get-url origin
ssh://git@github.com/pwmt/zathura.git
$ cd ..
But inside .git/config
但是在.git/config
里面
[submodule "zathura"]
url = https://github.com/pwmt/zathura.git
And inside .gitmodules
在.gitmodules
里面
[submodule "zathura"]
path = zathura
url = https://github.com/pwmt/zathura.git
ignore = dirty
Why the Remote urls are inconsistent (a mixture of https and ssh)?为什么远程 url 不一致(https 和 ssh 的混合)? Is this valid?这是有效的吗? Or is it due to some mistake that I might have done?还是因为我可能犯了一些错误? How can I have consistent remote url and which url is used by git?如何获得一致的远程 url 以及 git 使用哪个 url?
From the comments of Git Submodules equivalent for url.insteadof
, this should work:根据Git Submodules 等效于url.insteadof
的评论,这应该有效:
git -c url.https://github.com/.insteadOf=git@github.com: submodule update --init --recursive
That way, you can test the effect of an insteadOf
directive, and make sure HTTPS is used everywhere.这样,您可以测试insteadOf
指令的效果,并确保 HTTPS 在任何地方都使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.