开发者

Why is git submodule update failing?

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:

  1. The second .gitmodules entry (web/old) is cloned just fine, with no issues.
  2. 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).
  3. git clo开发者_运维技巧ne 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 = 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


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:

git://amygdala.servebeer.com/lucky_blog.git
git://amygdala.servebeer.com/old_lucky.git

You will not only need to commit those changes to .gitmodules, but also change the config with:

$ 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

... and to make sure that the submodules are re-cloned, remove them and try the git submodule update again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜