🌐 RemoteCommonly used

How to change the remote URL in Git

Update the URL of a remote repository β€” switch from HTTPS to SSH or change repo.

Change remote URL
git remote set-url origin https://github.com/user/new-repo.git

Updates the URL for the "origin" remote.

When to use: Repository was moved, renamed, or you want to switch between HTTPS and SSH.

Switch from HTTPS to SSH
git remote set-url origin git@github.com:user/repo.git

Changes from HTTPS to SSH authentication. No more password prompts.

When to use: After setting up SSH keys, switch to SSH for easier authentication.

Verify the change
git remote -v

Confirms the remote URL was updated correctly.

← Back to Git Reference