I wanted to rename one of my repositories on GitHub, but I got scared when a big red warning said:
- We will not set up any redirects from the o
Note that since May 2013 ("Repository redirects are here!"), you can rename your GitHub repo without breaking any links:
We're happy to announce that starting today, we'll automatically redirect all requests for previous repository locations to their new home in these circumstances. There's nothing special you have to do. Just rename away and we'll take care of the rest.
As a special bonus, we'll also be servicing all Git clone, fetch, and push requests from previous repository locations.
That means you don't even have to git remote set-url
(change the url of your remote GitHub repo) on your local cloned repo!
Although Gabriel notes in the comments that the official GitHub help page strongly recommends that you do so:
to reduce confusion, we strongly recommend updating any existing local clones to point to the new repository URL. You can do this by using git remote on the command line:
git remote set-url origin new_url
Beware though:
GitHub Pages sites are not automatically redirected when their repositories are renamed at this time.
Renaming a Pages repository will continue to break any existing links to content hosted on thegithub.io
domain or custom domains.
Plus, the user still owns the namespace: if he/she creates a new repo using the old name of the renamed repo, that redirection (for said renamed repo) will stop working.
I have tried to rename the repository on the web page:
setting
, click it and then you can find the Repositories
under the Personal setting
. Repositories
and enter your directories of Repositories, choose the Repository that you want to rename. setting
is added to the top line, just click it and enter the new name then click Rename
. Done, so easy.
1) Open your project url: https://github.com/someuser/project-name
2) in the top, aside of the project name, click EDIT
I see a lot of positive feedback to responses I don't find accurate/complete at all.
There are two things to have in mind:
If you haven't cloned your repo in your machine yet, you just need to rename the Github repository and then proceed to clone the repo so you can have a local copy. In order to rename the Github repo, you just need to:
If you already have a local copy of the project, apart from following the steps above, you need to make sure your local repository (root folder) is renamed properly and it's pointing to the right remote url :) link. In order to achieve that, do the following:
mv -R current-repo-name new-repo-name
$ git remote set-url origin https://github.com/userX/repositoryU
or
$ git remote set-url origin git@github.com:userX/repositoryU.git
The second step is not mandatory, though. Github announced a while ago that they would redirect all requests from previous repository urls to the assigned ones. That means you don't need to use $ git remote set-url ...
, but they still encourage you to do so to avoid confusion.
Hope it helped. If you have any questions or the post is not clear enough, let me know.
I rename my own just by simply :
After this step, GitHub will make sure that, your online repository matches your local folder name. At this step your problem is solved, unless you also want to rename your local folder. Then do it manually and just use the Github client for windows to refind again your repository into your hard drive, and Github will match it again. That's all! Very simple.