Git-如何通过URL删除远程

问题描述

我尝试搜索如何通过URL删除远程,但是所有建议都是删除整个远程并重新添加所需的URL。

最初,我使用命令添加了网址,

git remote set-url --add --push all C:\Users\UserName\Desktop\TestPath

然后,在配置文件中所有可用的URL中,如何仅删除该特定URL行? (黄色突出显示

config file

我确实尝试了以下命令git remote set-url --delete all C:\Users\UserName\Desktop\TestPath 但我收到此错误-> Could not unset 'remote.all.url'

我还使用git config --list --show-origin检查了可用路径,只是为了再次确认该值仅来自该特定文件

任何想法将不胜感激!

谢谢。

解决方法

您需要使用--push参数,并在url路径中使用两个斜杠(因此,其写入方式与配置文件中的方式相同)。

git remote set-url --delete --push all C:\\Users\\UserName\\Desktop\\TestPath

--push参数将指示操纵URL而不是获取URL(git remote documentation