Question:
When trying to add a remote origin to my local repository, I am getting “fatal: remote origin already exists” error.
1 |
git remote add origin git@github.com:cloudaffaire/myapp.git fatal: remote origin already exists. |
Answer:
As the error message indicates, there is already a remote configured with the same name. So you can either add the new remote with a different name or update the existing one if you don’t need it:
To add a new remote, called for example github
instead of origin
(which obviously already exists in your system), do the following:
1 2 |
git remote add github git@github.com:cloudaffaire/myapp.git |
Remember though, everywhere in the tutorial you see “origin” you should replace it with “github”. For example $ git push origin master
should now be $ git push github master
.
However, if you want to see what that origin
which already exists is, you can do a $ git remote -v
. If you think this is there by some error, you can update it like so:
1 |
git remote set-url origin git@github.com:cloudaffaire/myapp.git |