Skip to content

Meet Graphite Agent — your collaborative AI reviewer, built right into your PR page.

Read more

"Fatal remote origin already exists"

Greg Foster
Greg Foster
Graphite software engineer
Try Graphite


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


Table of contents

The error fatal: remote origin already exists occurs when you try to add a remote named "origin" to a Git repository that already has a remote with that name.

This error typically occurs in these scenarios:

  1. Repository already cloned: When you clone a repository, Git automatically creates a remote called "origin" pointing to the source repository
  2. Previous remote added: You or someone else previously added an "origin" remote to this repository
  3. Accidental duplicate command: You ran git remote add origin twice
  4. Repository migration: You're trying to change the remote URL but used the wrong command

If you want to change where "origin" points to:

Terminal
git remote set-url origin <new-repository-url>

If you want to add another remote alongside the existing "origin":

Terminal
git remote add <different-name> <repository-url>

If you need to completely replace the origin remote:

Terminal
git remote remove origin
git remote add origin <new-repository-url>

To see what remotes you currently have configured:

Terminal
git remote -v

While Graphite can't fix this specific error once it occurs, it can help prevent remote management headaches:

  • Streamlined workflow: Graphite handles repository setup automatically, reducing the chance of remote configuration mistakes
  • Clear repository state: Get better visibility into your repository's configuration and status
  • Simplified Git operations: Focus on your code changes rather than wrestling with Git configuration issues

Ready to simplify your Git workflow? Try Graphite for free and experience a more intuitive way to manage your repositories and pull requests.

No, each remote must have a unique name. If you need multiple remotes pointing to different repositories, use different names like "origin", "upstream", "fork", etc.

git remote set-url updates an existing remote's URL, while git remote add creates a new remote. Use set-url when you want to change where an existing remote points, and add when you want to add a completely new remote.

No, changing the remote URL only affects where you push/pull from. Your local commits and branches remain unchanged.

You can re-add it using git remote add <name> <url>. If you're unsure of the URL, check your Git hosting platform (GitHub, GitLab, etc.) for the repository's clone URL.

Git doesn't have a direct rename command, but you can achieve this by adding a new remote with the desired name and removing the old one:

Terminal
git remote add <new-name> <url>
git remote remove <old-name>

"Origin" is Git's conventional name for the primary remote repository. It's automatically created when you clone a repository and represents the "origin" of your local copy.

Built for the world's fastest engineering teams, now available for everyone