Git警告:配置远程速记不能以'/';
我刚刚从一些旧版本升级了Git,现在每当我从远程存储库中提取时,都会收到以下警告消息:Git警告:配置远程速记不能以'/';,git,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 这个远程存储库是U盘上的一个目录,我使用它将文件传输到计算机,而
$ git pull
warning: Config remote shorthand cannot begin with '/': /mnt/titanium/repos.url
warning: Config remote shorthand cannot begin with '/': /mnt/titanium/repos.fetch
这个远程存储库是U盘上的一个目录,我使用它将文件传输到计算机,而无需直接连接网络。U盘安装在/mnt/钛上
$ 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)
My.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
我阅读了有关此更改的原因,但我不明白该怎么做才能消除此警告?我建议编辑您的
.git/config
以将遥控器从/mnt/titanium/repos
重命名为简单的repos
。url仍然应该是/mnt/titanium/repos
,但在实际的远程名称中不应该包含该url。您可能还需要编辑fetch
参考:
[remote "repos"]
url = /mnt/titanium/repos
fetch = +refs/heads/*:refs/remotes/repos/*
编辑
现在我已经看到了您的配置,看起来您只是有一个名为
“/mnt/titanium/repos”
的额外远程设备,其中远程设备的名称和URL是反向的,因为它的URL是源代码(不确定是用户错误还是软件错误)。无论如何,看起来您根本不需要它,因为“origin”
remote的定义是正确的。您可以删除整个“/mnt/titanium/repos”
remote(包含该字符串的行和后面的两行),并且应该不会有任何问题。我建议编辑.git/config
将远程从/mnt/titanium/repos
重命名为简单的repos
。url仍然应该是/mnt/titanium/repos
,但在实际的远程名称中不应该包含该url。您可能还需要编辑fetch
参考:
[remote "repos"]
url = /mnt/titanium/repos
fetch = +refs/heads/*:refs/remotes/repos/*
编辑
现在我已经看到了您的配置,看起来您只是有一个名为“/mnt/titanium/repos”
的额外远程设备,其中远程设备的名称和URL是反向的,因为它的URL是源代码(不确定是用户错误还是软件错误)。无论如何,看起来您根本不需要它,因为“origin”
remote的定义是正确的。您可以删除整个“/mnt/titanium/repos”
remote(包含该字符串的行和下面两行),并且不应该有任何问题。您可以包括.git/config
,或者至少是[remote…]
部分吗?您可以包括.git/config
,或者至少是[remote…]
部分?谢谢。这台计算机过去有一个网络连接,所以它从服务器中提取更改,并且原点设置不同。当时我添加了一个U盘作为另一个选项。后来,当网络被移除时,我在谷歌上搜索并找到了一些切换原点的方法(这样简单的git拉/推操作就可以了,没有任何参数)。@Milanbabškov啊,这是有道理的。现在我看了看,我在谷歌上搜索的命令似乎有“原点”和路径的错误顺序。我可能尝试过,看到它不起作用,然后反过来,它起作用了-但我没有费心编辑配置来删除错误的行。谢谢。这台计算机过去有一个网络连接,所以它从服务器中提取更改,并且原点设置不同。当时我添加了一个U盘作为另一个选项。后来,当网络被移除时,我在谷歌上搜索并找到了一些切换原点的方法(这样简单的git拉/推操作就可以了,没有任何参数)。@Milanbabškov啊,这是有道理的。现在我看了看,我在谷歌上搜索的命令似乎有“原点”和路径的错误顺序。我可能尝试过,看到它不起作用,然后反过来,它起作用了-但我没有费心编辑配置来删除错误的行。