Skip to content

Update the origin remote

origin is the conventional name for the remote repository from which a project was cloned. Inspect it before changing it:

git remote -v

Change the existing URL

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

For example:

git remote set-url origin https://github.com/<owner>/<repository>.git

Confirm the result:

git remote get-url origin
git remote -v

Add origin when it does not exist

git remote add origin <repository-url>

Check the destination

git push sends commits to the configured remote. Run git remote -v before pushing after changing origin, especially when moving a project or switching between personal and organization repositories.