Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to safely change github account name?

I would like to change my github account name, I found an option in GitHub account settings.

However, I am concerned about consequences and would like to know what is the best strategy of name change, considering that I have some projects of my own tied to this account.

So far, I came up with this plan:

  1. Change account name in GitHub settings
  2. For each project's local folder in '.git / config' file update remote "origin" url to the new one

Will this work? Should there be any further steps on a computer which holds project sources? What will be the effect of name change on those who cloned or forked my projects on GitHub?

Thank you!

like image 995
mikhail-t Avatar asked Jun 04 '12 22:06

mikhail-t


People also ask

Should I use my real name for GitHub Account?

You should use your real name. My lab has a private GitHub group for internal stuff, as well as a few open public-facing projects. Everyone in our group uses their real names or some transparent abbreviation (like jsmith ) or one that matches their university email/login ID.

How many times can you change your GitHub name?

You can change your Github account name at any time. Links to your repositories will redirect to the new URLs, but they should be updated on other sites because someone who chooses your abandoned username can override the links. Links to your profile page will be 404'd. For more information, see the official help page.


2 Answers

1.) You have to change all your projects remote addresses. You can see them via:

git remote -v

After that remove the old remote addres:

git remote rm [email protected]:old_account/foo.git

finally add your new remote address:

git remote add origin [email protected]:new_account/foo.git

2.) All your cloned repos will break. There is no URL-redirect or anything similar. You can change your local cloned repos, but others have to point to the new repo addres(like in Step 1)

Note: Github forked repos works without any problem.

like image 165
Fatih Arslan Avatar answered Sep 21 '22 15:09

Fatih Arslan


GitHub has recently changed their username rename system, and now sets up redirects for you.

From What happens when I change my username? on GitHub Help:

On the GitHub side, everything will behave as if your new username had always been your name. All of your repositories will now belong to that new name and the old username will essentially no longer exist. This can take a few minutes to complete after you initiate the change.

Links to your previous profile page, such as https://github.com/previoususername, return a 404 error. We cannot set up a redirect from the old username to the new one for references like @mentions.

However, redirects are setup for all your repositories. Both web and git access to the old location continue to function, and redirect toward the new username.

like image 27
Nick McCurdy Avatar answered Sep 21 '22 15:09

Nick McCurdy