How to Rename a Repository in GitHub

Renaming a repository in GitHub is simple, but it’s important to update your local Git setup afterward to avoid any disruption in your workflow. Whether you’re rebranding, organizing projects, or correcting a name, this guide walks you through renaming a GitHub repo safely.


✅ Step 1: Rename the Repository on GitHub

  1. Go to GitHub.com and log in.
  2. Navigate to the repository you want to rename.
  3. Click the Settings tab (on the top menu of the repo).
  4. In the Repository name field (under the “General” section), change the name.
  5. Click the Rename button to save your changes.

💡 GitHub will automatically redirect visitors from the old repo URL to the new one—but this redirection is not guaranteed forever, so it’s good practice to update local references.


✅ Step 2: Update the Remote URL in Your Local Repository

After renaming your repo on GitHub, you must update the remote URL in your local Git configuration:

1. Check your current remote:

git remote -v

Output might look like:

origin  https://github.com/username/old-repo-name.git (fetch)
origin  https://github.com/username/old-repo-name.git (push)

2. Update to the new URL:

git remote set-url origin https://github.com/username/new-repo-name.git

Or use SSH if that’s your setup:

git remote set-url origin [email protected]:username/new-repo-name.git

3. Test the connection:

git fetch origin

If you don’t get any errors, the remote is updated successfully.


⚠️ Things to Consider

  • GitHub Pages: If you’re using GitHub Pages, the site URL may change based on the repo name.
  • Shared Projects: Let collaborators know the repo name has changed.
  • CI/CD Pipelines: Check that any automated tools, scripts, or webhooks using the old repo name are updated.
  • Dependencies: If the repo is used as a dependency (e.g., in package managers or submodules), update references there too.

🧠 Pro Tip

Use a naming convention that reflects the project’s purpose or scope. A clear, descriptive name makes collaboration and discovery easier.


🔁 Summary

TaskCommand or Step
Rename on GitHubSettings → Change repository name → Click Rename
Check current remote URLgit remote -v
Update remote URL locallygit remote set-url origin <new-url>
Verify updategit fetch origin

Renaming a GitHub repository is quick, but following up with a remote URL update in your local Git setup ensures smooth ongoing development.

Sharing Is Caring:

Leave a Comment