Oct*_*lop 8 git git-submodules
我有以下 .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
Run Code Online (Sandbox Code Playgroud)
当我克隆repo并运行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
Run Code Online (Sandbox Code Playgroud)
我观察到引起一些担忧的三件事:
.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
Run Code Online (Sandbox Code Playgroud)
Mar*_*air 11
您的git URL格式有点错误 - 您应该将主机与路径分开/而不是:.尝试将网址更改为:
git://amygdala.servebeer.com/lucky_blog.git
git://amygdala.servebeer.com/old_lucky.git
Run Code Online (Sandbox Code Playgroud)
您不仅需要提交这些更改.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
Run Code Online (Sandbox Code Playgroud)
...并确保重新克隆子模块,将其删除并git submodule update再次尝试.