This being the 2,38947234th and probably last time I’ll change my username, (marriage is permanent, right?) I thought I’d better write a quick post on how this transition can be achieved as smoothly as possible. You can read official instructions on how to change your GitHub username here, and they will tell you how to do it and what happens. The following is a quick guide to some things to consider afterwards.
Where to make changes
- Change username in GitHub account settings.
- If using GitHub Pages, change name of your “username.github.io” repository.
- If using other services that point to your “username.github.io” repository address, update them.
- If using Netlify, you may want to sign in and reconnect your repositories. (Mine still worked, but due to a possibly unrelated issue, I’m not positive.)
- Sign in to Travis CI and other integrations (find them in your repository Settings tab -> Integrations & services). This will update your username there.
- Update your local files and repository links with very carefully executed
sedcommands, and push back changes to GitHub.
- Redeploy any websites you may have with your updated GitHub link.
- Fix any links around the web to your profile, your repositories, or Gists you may have shared.
Local file updates
Here are some suggestions for strings to search and replace your username in.
github.com/username(References to your GitHub page in READMEs or in website copy)
username.github.io(Links to your GitHub Page)
email@example.com:username(Git config remote ssh urls)
travis-ci.com/username(Travis badges in READMEs)
shields.io/github/.../username(Shields badges in READMEs, types include
tags, and more)
You can quickly identify where the above strings are located using this command for each string:
grep -rnw -e 'foobar'
This will recursively (
r) search all files for strings matching the whole (
w) pattern (
e) provided and prefix results with the line numbers (
n) so you can easily find them.
sed can make these changes much faster. See this article on search and replace.
Enjoy your new handle! (I hope it sticks.)