Michael Boutin

Change a git remote's URL

bashMay 10, 2026

Point an existing remote at a new URL without removing and re-adding it.

When a repo moves hosts (or you switch between SSH and HTTPS), update the existing remote in place instead of deleting it and adding it back.

terminal
git remote set-url origin new.git.url/here

Run git remote -v afterwards to confirm both fetch and push URLs point where you expect.

Liked this? Get the next one in your inbox.

One email every other Tuesday. Engineering, product, and what I'm shipping. Unsubscribe anytime.

No spam. See the privacy policy.

  • bash

    Delete local and remote git branches

    Delete branches one at a time, or sweep up local branches whose upstream has already been deleted.

    May 10, 2026
  • bash

    Remove node_modules from a git repo

    Stop tracking a committed node_modules folder and ignore it going forward.

    May 10, 2026
  • bash

    Stop tracking a file that's already committed

    Adding a path to .gitignore does not untrack files git already knows about. Use git rm --cached to drop it from the index while keeping the local copy.

    May 6, 2026