如何删除我在Git中添加的无效遥控器?

时间:2011-04-20 12:51:41

标签: git

这是我解雇的一行:

git remote add Nakor git://github.com.nakor/CherryTomato.git

我犯了一个错误,命令应该是:

git remote add Nakor git://github.com/nakor/CherryTomato.git

当我尝试运行第二个命令时,我收到此错误:

fatal: Remote Nakor already exists.

这是可以理解的。如何编辑远程Nakor指向的端点?

4 个答案:

答案 0 :(得分:17)

您可以使用git remote的set-url子命令:

git remote set-url Nakor git://github.com/nakor/CherryTomato.git

答案 1 :(得分:7)

当其他所有方法都失败时:

git config --edit

...下

[remote "Nakor"]

...编辑专栏......

    url = git://github.com.nakor/CherryTomato.git

答案 2 :(得分:2)

来自github help Removing a remote

git remote -v
# View current remotes
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)
destination  https://github.com/FORKER/REPOSITORY.git (fetch)
destination  https://github.com/FORKER/REPOSITORY.git (push)

git remote rm destination
# Remove remote
git remote -v
# Verify it's gone
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)

答案 3 :(得分:1)

git remote --help告诉所有人。在这种情况下,请使用git remote set-url ...