Home › Git

error: remote origin already exists. — how to fix

error: remote origin already exists.

Quick fix: Update the URL: git remote set-url origin https://github.com/USER/REPO.git. Check with git remote -v.

What it means

git remote add origin <url> creates a remote called origin, but this repository already has one, often because you cloned it or ran the command before.

See what's configured

git remote -v

Fix 1: change the URL

git remote set-url origin https://github.com/USER/REPO.git

Fix 2: remove and add again

git remote remove origin
git remote add origin https://github.com/USER/REPO.git

Fix 3: keep both

Want to push to a fork and the original? Give the new one another name:

git remote add upstream https://github.com/ORIGINAL/REPO.git
git fetch upstream

A common convention: origin = your fork, upstream = the original project.

Last updated 2026-10-27.