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) and a second computer still points at the old name.

Note: Rename the repo on GitHub first (Settings → General → Repository name). Then update each computer as 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 content repository is based on the hands-on experience of Naveen Bachwani. AI tools were also used in augmenting and refining it. The goal is to help non-technical users get familiar with these tools, so they may be able to use them effectively.

Readers are responsible for using any commands or instructions provided here with appropriate caution. The creator of this site accepts no responsibility for system damage, data loss, or other consequences resulting from their use.