Yes, you can rename a repository on GitHub in a few clicks, and it takes less than a minute

GitHub lets you change your repository name at any time through your repository settings. The process is straightforward: go to your repository, click Settings, find the Repository Name field, type the new name, and confirm. GitHub will automatically redirect traffic from the old URL to the new one for a period of time, so existing links and clones won't break when ready.

The main thing to know is that while the rename itself is when ready, anyone who has cloned the repository locally will need to update their remote URL to point to the new name. This is a one-line command on their end, but it's worth communicating the change if other people are working from your repository.

Key Takeaways

  • You rename a repository by going to Settings, scrolling to the Repository Name field, entering the new name, and clicking Rename.
  • GitHub automatically redirects the old repository URL to the new one, so links and bookmarks will still work for a while.
  • Anyone who has cloned the repository locally must run git remote set-url origin [new-url] to update their local copy.
  • Renaming does not affect your code, commit history, issues, pull requests, or any other repository data.
  • You can rename a repository as many times as you want, and there is no limit on how often you do this.

Step-by-step: renaming your repository

Open your repository on GitHub and click the Settings tab near the top right of the page. On the left sidebar, you'll see General selected by default. Scroll down until you see the Repository Name field — this is where your current repository name appears.

Click in the Repository Name field, clear the old name, and type the new one. Repository names on GitHub can contain letters, numbers, hyphens, and underscores. GitHub will show you whether the name is available as you type. Once you've entered the new name, click the Rename button below the field.

That's it. The rename is complete. Your repository is now live under the new name, and GitHub has set up a redirect from the old URL so that old links still work.

What happens to people who cloned your repository

If someone has already cloned your repository to their computer, their local copy still points to the old repository URL. They won't lose their work or their commit history, but their git remote — the connection between their local folder and your repository on GitHub — will be out of date.

They can fix this with one command. They should open their terminal or command prompt, navigate to the repository folder, and run:

git remote set-url origin https://github.com/[your-username]/[new-repository-name].git

They should replace [your-username] with your GitHub username and [new-repository-name] with the new name you chose. After they run this command, their local copy is reconnected to the renamed repository.

GitHub's automatic redirect and how long it lasts

When you rename a repository, GitHub keeps the old URL active and redirects anyone who visits it to the new one. This redirect lasts for a period of time — GitHub does not publish an exact expiration date, but the redirect is designed to give people time to update their bookmarks, documentation, and local configurations.

This means that if someone clicks an old link to your repository, they'll be taken to the new one automatically. However, it's still a good idea to update any documentation, README files, or external links that point to your repository, because relying on the redirect indefinitely is not may provide to work.

What does not change when you rename

Renaming a repository does not affect your code, commit history, branches, tags, or any of the work inside it. All your issues, pull requests, discussions, and project boards stay exactly as they are. Your repository's description, topics, and other metadata remain unchanged. The only thing that changes is the URL and the name displayed on GitHub.

If your repository is part of a GitHub organization, the rename works the same way. If you have branch protection rules or other settings tied to the repository name, those continue to work after the rename.

Renaming a forked repository

If you've forked someone else's repository, you can rename your fork just like any other repository you own. The rename does not affect the original repository or your connection to it. You can still fetch updates from the upstream repository and create pull requests back to the original, even after renaming your fork.

If you want to rename your fork to something completely different from the original, that's fine — there's no requirement to keep the same name as the upstream repository.

Renaming a repository with a lot of external links

If your repository is well-known and linked from many places — documentation sites, Stack Overflow answers, blog posts, or other repositories — renaming it can break those external links. The GitHub redirect will catch some of them, but not all. Before renaming a popular repository, consider whether the new name is worth the disruption.

If you do rename, you can add a note to your old repository (if you keep it) or to your GitHub profile explaining where the repository moved. You can also search GitHub for references to your old repository name and update the most important ones manually.

Frequently Asked Questions

Can I rename a repository if it's part of an organization?

Yes. If you have admin access to the organization repository, you can rename it the same way you would rename a personal repository. Go to Settings, find the Repository Name field, and enter the new name. The process is identical.

What if the new name I want is already taken?

GitHub will tell you the name is unavailable as you type in the Repository Name field. You'll need to choose a different name. You can check whether a name is available by trying to create a new repository with that name, or by searching GitHub for repositories with that name.

Will renaming break my GitHub Pages site?

If your repository is named [username].github.io, renaming it will break your GitHub Pages site because GitHub Pages looks for a repository with that exact name. If you have a project site (not a user or organization site), renaming the repository will change the URL of your site unless you update your GitHub Pages settings to point to a custom domain.

Can I undo a rename and go back to the old name?

Yes. You can rename your repository as many times as you want. If you want to go back to the old name, just go to Settings and change it back. There's no limit on how many times you can rename a repository.

Do I need to update my local clone when ready after a rename?

Not when ready, because GitHub's redirect will keep your local clone working for a while. However, it's a good idea to update it soon by running git remote set-url origin with the new URL, so you're not relying on the redirect indefinitely.