I am working with a ruby on rails application and I am trying to sync a fork. It is worth mentioning that I am also on a Mac. I committed the following action:
$ git remote -v
to get a view of my local repository. I messed up when trying to go upstream
:
$ git remote add upstream https://github.com/foo/repo.git
When I should have capitalized Foo:
$ git remote add upstream https://github.com/Foo/repos.git
The question is how do I remove the upstream
because every time I try and change this it comes back with creating a fatal
error?
If you like, you can use --unset-upstream to remove the upstream and stop the complaints, and not have local branch source marked as having any upstream at all. The point of having an upstream is to make various operations more convenient.
You can reset your local master branch to the upstream version and push it to your origin repository. (You can define the original repo as "upstream" with git remote add upstream /url/to/original/repo .) It should probably be git reset --hard upstream/master to reset the working directory, too.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With