Git警告:配置远程速记不能以'/'开头

时间:2013-10-22 10:34:55

标签: git

我刚刚从一些旧版本升级了Git,现在每当我从远程存储库中提取时都会收到此警告消息:

$ git pull
warning: Config remote shorthand cannot begin with '/': /mnt/titanium/repos.url
warning: Config remote shorthand cannot begin with '/': /mnt/titanium/repos.fetch

这个远程存储库是USB记忆棒上的一个目录,我用它将文件传输到没有直接网络连接的计算机。 USB记忆棒安装在/ mnt / titanium

$ git remote -v
warning: Config remote shorthand cannot begin with '/': /mnt/titanium/repos.url
warning: Config remote shorthand cannot begin with '/': /mnt/titanium/repos.fetch
origin  /mnt/titanium/repos (fetch)
origin  /mnt/titanium/repos (push)

我的.git / config看起来像这样:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[branch "master"]
[remote "/mnt/titanium/repos"]
        url = origin
        fetch = refs/heads/*:refs/remotes//mnt/titanium/repos/*
[remote "origin"]
        url = /mnt/titanium/repos
        fetch = refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

我读到了有关此更改的原因,但我不明白应该怎样做以使此警告消失?

1 个答案:

答案 0 :(得分:4)

我建议您修改.git/config,将遥控器从/mnt/titanium/repos重命名为repos。该网址仍应为/mnt/titanium/repos,但实际的远程名称中不应包含该值。您可能还需要编辑fetch参考:

[remote "repos"]
    url = /mnt/titanium/repos
    fetch = +refs/heads/*:refs/remotes/repos/*

修改

现在我已经看到了你的配置,看起来你只是有一个额外的名为"/mnt/titanium/repos"的遥控器,其中遥控器的名称和URL是相反的,因为它的网址为{{1} }(不确定是否来自用户错误或软件错误)。无论如何,看起来你根本不需要它,因为origin遥控器被正确定义。您可以删除整个"origin"遥控器(包含该字符串的行以及两行),并且不应该有任何问题。