开发者

How do I remove an invalid remote I added in Git?

开发者 https://www.devze.com 2023-02-28 03:01 出处:网络
Her开发者_JAVA百科e\'s the line I fired: git remote add Nakor git://github.com.nakor/CherryTomato.git

Her开发者_JAVA百科e's the line I fired:

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

I made a mistake and the command should have been:

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

When I try to run the second command, I get this error:

fatal: Remote Nakor already exists.

Which is understandable. How can I edit the endpoint the remote Nakor is pointing to?


you can use the set-url subcommand of git remote:

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


When all else fails:

git config --edit

Under...

[remote "Nakor"]

...edit the line...

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


From 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)


git remote --help tells all. In this instance, use git remote set-url ....

0

精彩评论

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