Git error Fatal: remote origin already exists (Quick Fix)

Git error Fatal: remote origin already exists
Git error Fatal: remote origin already exists

GitHub: Git error Fatal: remote origin already exists

When you get the error fatal: remote origin already exists. after running this command inside a local Git repository and pushing the code to GitHub.

So recently I came up with a solution so I decided to share how to solve this error with you guys.
When you get this error :

  1. During pushing your code to the GitHub
  2. Cloning your repo from GitHub

It commonly occurs when you clone a remote repository with a configured remote origin URL. But Git doesn’t operate that way.

Replace add origin with a set-url origin for a simple fix.

The set-url command merely modifies your repository’s origin URL so that it no longer points to the profile from which you cloned the project but rather to your remote repository.

Conclusion

I hope this post will help you to solve this error which is Git error Fatal: remote origin already exists. Feel free to comment if you have any sought regarding this error.

People are also reading:

Leave a Reply

Your email address will not be published. Required fields are marked *