为什么 git 子模块更新失败?
我有以下 .gitmodules 文件:
[submodule "web/blog"]
path = web/blog
url = git://amygdala.servebeer.com:lucky_blog.git
[submodule "web/old"]
path = web/old
url = git://amygdala.servebeer.com:old_lucky.git
当我克隆存储库并运行 git submodule init && git submodule update (或 git submodule init --update
) 我收到以下错误:
Cloning into web/blog...
fatal: Unable to look up (port 9418) (Name or service not known)
Clone of 'git://amygdala.servebeer.com:lucky_blog.git' into submodule path 'web/blog' failed
我观察到三件事引起了一些关注:
- 第二个
.gitmodules
条目(网络/旧)克隆得很好,没有任何问题。 - 错误消息中似乎有一个额外的空格,我认为 git 通常会列出它无法查找的主机名(就在上面列出的错误中列出的端口号之前)。
git clone git://amygdala.servebeer.com:lucky_blog.git
工作得很好。
这个仓库有什么问题吗?这是 git 的错误还是我在设置存储库时搞砸了?
编辑这是我的 git 配置供参考:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:luckybead.git
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "web/blog"]
url = git://amygdala.servebeer.com:lucky_blog.git
[submodule "web/old"]
url = git://amygdala.servebeer.com:old_lucky.git
I have the following .gitmodules
file:
[submodule "web/blog"]
path = web/blog
url = git://amygdala.servebeer.com:lucky_blog.git
[submodule "web/old"]
path = web/old
url = git://amygdala.servebeer.com:old_lucky.git
When I clone the repo and run git submodule init && git submodule update
(or git submodule init --update
) I get the following error:
Cloning into web/blog...
fatal: Unable to look up (port 9418) (Name or service not known)
Clone of 'git://amygdala.servebeer.com:lucky_blog.git' into submodule path 'web/blog' failed
I observe three things which cause some concern:
- The second
.gitmodules
entry (web/old) is cloned just fine, with no issues. - There appears to be an extra space in the error message, where I think git would normally list the hostname it fails to look up (right before the port number listing in the error listed above).
git clone git://amygdala.servebeer.com:lucky_blog.git
works just fine.
What is wrong with this repo? Is this an error with git or did I screw something up when setting up the repo?
Edit Here's my git config for reference:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:luckybead.git
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "web/blog"]
url = git://amygdala.servebeer.com:lucky_blog.git
[submodule "web/old"]
url = git://amygdala.servebeer.com:old_lucky.git
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 git URL 格式 稍有错误 - 您应该将使用
/
而不是:
从路径中主机。尝试将 URL 更改为:您不仅需要将这些更改提交到
.gitmodules
,还需要使用以下命令更改配置:... 并确保重新克隆子模块,将其删除并再次尝试
git submodule update
。You have the format of your git URLs slightly wrong - you should separate the host from the path with
/
rather than:
. Try changing the URLs to:You will not only need to commit those changes to
.gitmodules
, but also change the config with:... and to make sure that the submodules are re-cloned, remove them and try the
git submodule update
again.