Skip to content

Renaming Git Repos

Last updated 2026-08-20 · 3 notes · 3 tags

Tags: git github rename

Use this when the GitHub repo was renamed (or you renamed the local folder on one device) but a second device still points at the old name.

Note: If you also want to rename the online GitHub repo name, rename the repo on GitHub first (Settings → General → Repository name), then update each computer as shown below...

1. Open your projects folder

cd ~/projects

2. Rename the local folder (if needed)

mv old-repo-name new-repo-name
cd new-repo-name

3. Point Git at the new GitHub URL

git remote set-url origin https://github.com/YOUR_GITHUB_USERNAME/YOUR_REPO.git

Note: Replace YOUR_GITHUB_USERNAME and YOUR_REPO with the values shown on the repo’s GitHub page (green Code button).

4. Fetch and pull

git fetch origin
git pull

5. Verify

git remote -v
git status

You should see the new URL under origin and a clean status (or only your local unfinished work).

Note: SSH users will use a URL like git@github.com:YOUR_GITHUB_USERNAME/YOUR_REPO.git instead of https://....

Common mistakes

  • Update every machine that still has a clone of the old name.
  • If git pull complains about unrelated histories, stop and get help — do not force-push until you understand the warning.

This project captures ideas, decisions, and lessons I’ve learned while building with AI. It aims to help non-technical users understand and use these tools effectively. I also use AI at times to improve or refine the content.

Readers should use the commands and instructions here with care. The creator accepts no responsibility for system damage, data loss or other consequences resulting from their use.