Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (29.3k points)

I signed up on Github and issued a new SSH key and made a new repository. But when I enter the next line into the terminal I get the following error:

Parkers-MacBook-Pro:.ssh ppreyer$ git remote add origin [email protected]:ppreyer/first_app.git

fatal: remote origin already exists.

Just wondered if anybody else has run across this problem?

1 Answer

+2 votes
by (50.2k points)

For this type of error you should just update the existing remote using:

$ git remote set-url origin [email protected]:ppreyer/first_app.git

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:

To add a new remote, for example, github instead of origin, do the following:

$ git remote add github [email protected]:ppreyer/first_app.git

While pushing you should use

git push github master

Thus, you can resolve this issue by creating a new remote with a different name instead of origin.

Github “fatal: remote origin already exists”
by (29.3k points)
Thanks, this information helps me a lot.

Browse Categories