git
config_error
ai_generated
true
fatal: remote origin already exists
ID: git/remote-already-exists
98%Fix Rate
95%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2 | active | — | — | — |
Root Cause
Trying to add a remote that already exists.
genericWorkarounds
-
98% success Update existing remote URL: git remote set-url origin <new-url>
git remote set-url origin https://github.com/user/repo.git
Sources: https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emset-urlem
-
92% success Remove and re-add: git remote remove origin && git remote add origin <url>
git remote remove origin && git remote add origin
Sources: https://git-scm.com/docs/git-remote
Dead Ends
Common approaches that don't work:
-
Delete the .git folder and reinitialize
95% fail
Destroys all commit history
-
Create a new remote with a different name
60% fail
Having two remotes for the same repo is confusing
Error Chain
Frequently confused with: