Git removing upstream from local repository

Using git version 1.7.9.5 there is no “remove” command for remote. Use “rm” instead.

$ git remote rm upstream
$ git remote add upstream https://github.com/Foo/repos.git

or, as noted in the previous answer, set-url works.

I don’t know when the command changed, but Ubuntu 12.04 shipped with 1.7.9.5.

edit: a few people seem to have run into a situation where they do not have an “upstream” remote. execute cat .git/config and look at the name of the remote(s). (if on windows and not using powershell you can use type .git/config.)

the output will show the remotes configured for your git repo, e.g.,

[remote "origin"]

substitute the name of the remote you wish to remove as:

$ git remote rm origin

if you don’t have the “upstream” remote, you can’t remove it.

Leave a Comment