"Remote origin
already exists."
You ran git remote add origin and Git refused. Your repo already has a remote named origin. You do not need to add it again. You need to look at it, then change it or leave it.
The short answer
look firstLook
git remote -v lists every remote and its URL. If origin already points where you want, you are done.
Point it elsewhere
git remote set-url origin NEW-URL changes where origin points. This is the usual fix.
Start over
git remote remove origin, then run your git remote add origin URL again. The git remote rm spelling does the same.
Removing a remote only deletes the link in your local repository. It does not delete anything on GitHub.
What it looks like
message from GitHub Docsyou@laptop my-project % git remote add origin https://github.com/octocat/Spoon-Knife.git
fatal: remote origin already exists.
This is the message as shown in the GitHub Docs page on managing remotes. A remote name can only exist once per repository, so Git will not overwrite it for you.
Pick the fix that fits
what you wantgit remote set-url origin https://github.com/OWNER/REPOSITORY.gitgit remote add upstream URLupstream is the usual choice for the original repo of a fork.git remote rename origin old-origingit remote remove originCheck before and after
alwaysRun git remote -v before you change anything, and again after. Each remote shows once for fetch and once for push. After set-url both lines show the new address. Then git push -u origin main pushes to the new place, using whichever branch name you have.
When it goes wrong
related messagesfatal: not a git repository (or any of the parent directories): .gitYou are not inside a repositorySee the fix for this error.Questions people ask
Why does git say remote origin already exists?
Your repository already has a remote named origin, often from git clone, which sets it up for you. Names are unique, so git remote add origin fails.
How do I change the origin URL in Git?
Run git remote set-url origin NEW-URL, then check it with git remote -v.
Does git remote remove origin delete my GitHub repository?
No. It only removes the link from your local repository. The repository on GitHub is untouched.
How do I keep two remotes?
Give the second one a different name, for example git remote add upstream URL. Each remote name can exist once.