我有以下.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
条目(web / old)克隆得很好,没有问题。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 = git@amygdala.servebeer.com: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
答案 0 :(得分:11)
您的format of your git URLs略有错误 - 您应该将主机与/
而不是:
的路径分开。尝试将网址更改为:
git://amygdala.servebeer.com/lucky_blog.git
git://amygdala.servebeer.com/old_lucky.git
您不仅需要将这些更改提交到.gitmodules
,还需要更改配置:
$ git config submodule.web/blog.url git://amygdala.servebeer.com/lucky_blog.git
$ git config submodule.web/old.url git://amygdala.servebeer.com/old_blog.git
...并确保重新克隆子模块,将其删除并再次尝试git submodule update
。