Git “remote origin already exists”: repoint instead of re-adding
Inspect the existing origin, then repoint it or add the new URL under another name.
The remote name origin is already registered. Check what it points to with git remote -v: repoint it with git remote set-url if the URL is wrong, or add the new repository under a different name.
Try these fixes in order
See what origin currently points to
Run git remote -v to list every remote name and its fetch and push URLs. This tells you whether origin already points at the right repository or needs correcting.
git remote -vRepoint origin when the URL is wrong
If the name is right but the URL is wrong or outdated, update it in place with git remote set-url origin <repository-url>. This keeps branch upstream tracking intact.
git remote set-url origin <repository-url>Add the new URL under a different name
If origin is correct and you want an additional remote, such as a fork or a second host, add it under a distinct name like upstream or personal instead of reusing origin.
git remote add upstream <repository-url>Verify the configuration reaches the remote
Run git remote -v again and then git fetch origin (or the new remote name) to confirm Git can reach the configured URL before pushing.
git fetch originInterpret what you see
git remote -v shows an origin URL
What it suggests: The name origin is taken, but it may already point exactly where you want; the add command is just redundant.
Next check: Run git remote -v and compare the URLs with the one you intended to add.
The repository was cloned rather than created with git init
What it suggests: You are following setup instructions on a repository that already has an origin, for example after cloning instead of initializing.
Next check: Skip the add step; the remote is already configured and you can fetch or push directly.
The existing origin URL looks wrong or outdated
What it suggests: An earlier command added origin with a typo or a placeholder URL, and now the correct add fails on the name.
Next check: Use git remote set-url origin <correct-url> to fix the address in place.
Why this happens
- The repository was cloned, so origin was configured automatically, and a setup guide's git remote add step was run again.
- A previous git remote add already registered the name origin for a different URL.
Still not working?
Removing the remote with git remote remove origin also drops upstream tracking configuration for local branches. Prefer git remote set-url when the goal is simply to point an existing origin at a new address.
Official sources
These steps are based on the linked documentation and general diagnostics. BugMedic has not independently tested every product and system configuration. Review commands before running them.