About username changes
You can change your username to another username that is not currently in use. If the username you want is not available, consider other names or unique variations. Using a number, hyphen, or an alternative spelling might help you find a similar username that’s still available.
If you hold a trademark for the username, you can find more information about making a trademark complaint on our Trademark Policy page.
If you do not hold a trademark for the name, you can choose another username or keep your current username. GitHub Support cannot release the unavailable username for you. For more information, see «Changing your username.»
After changing your username, your old username becomes available for anyone else to claim. Most references to your repositories under the old username automatically change to the new username. However, some links to your profile won’t automatically redirect.
GitHub cannot set up redirects for:
- @mentions using your old username
- Links to gists that include your old username
If you’re a member of an enterprise with managed users, you cannot make changes to your username. For more information, see «Types of GitHub accounts.»
If the account namespace includes any public repositories that contain an action listed on GitHub Marketplace, or that had more than 100 clones or more than 100 uses of GitHub Actions in the week prior to you renaming your account, GitHub permanently retires the old owner name and repository name combination (OLD-OWNER/REPOSITORY-NAME) when you rename your account. If you try to create a repository using a retired owner name and repository name combination, you will see the error: «The repository <REPOSITORY_NAME> has been retired and cannot be reused.»
If the account namespace includes any packages or container images stored in a GitHub Packages registry, GitHub transfers the packages and container images to the new namespace. By renaming your account, you may break projects that depend on these packages. If the namespace includes any container images that are public and have more than 5,000 downloads, the full former name of these container images (OLD-NAMESPACE/IMAGE-NAME) is permanently retired when you rename the account to ensure the container image name cannot be reused in the future.
Repository references
After you change your username, GitHub will automatically redirect references to your repositories.
- Web links to your existing repositories will continue to work. This can take a few minutes to complete after you make the change.
- Command line pushes from your local repository clones to the old remote tracking URLs will continue to work.
If the new owner of your old username creates a repository with the same name as your repository, that will override the redirect entry and your redirect will stop working. Because of this possibility, we recommend you update all existing remote repository URLs after changing your username. For more information, see «Managing remote repositories.»
Links to your previous profile page
After changing your username, links to your previous profile page, such as https://github.com/previoususername, will return a 404 error. We recommend updating any links to your account on GitHub.com from elsewhere, such as your LinkedIn or Twitter profile.
Your Git commits
Git commits that were associated with your GitHub-provided noreply email address won’t be attributed to your new username and won’t appear in your contributions graph. If your Git commits are associated with another email address you’ve added to your GitHub account, including the ID-based GitHub-provided noreply email address, they’ll continue to be attributed to you and appear in your contributions graph after you’ve changed your username. For more information on setting your email address, see «Setting your commit email address.»
Your gists
After changing your username, the URLs to any public or secret gists will also change and previous links to these will return a 404 error. We recommend updating the links to these gists anywhere you may have shared them.
Changing your username
-
In the upper-right corner of any page, click your profile photo, then click Settings.
-
In the left sidebar, click Account.
-
In the «Change username» section, click Change username.
-
Read the warnings about changing your username. If you still want to change your username, click I understand, let’s change my username.
-
Type a new username.
-
If the username you’ve chosen is available, click Change my username. If the username you’ve chosen is unavailable, you can try a different username or one of the suggestions you see.
Further reading
- «Why are my commits linked to the wrong user?»
- «GitHub Username Policy»
Some additional steps to consider after making a change to your username on GitHub.
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
findandsedcommands, 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)git@github.com:username(Git config remote ssh URLs)travis-ci.com/username(Travis badges in READMEs)shields.io/github/.../username(Shields badges in READMEs, types includecontributors,stars,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.
Using find and sed can make these changes much faster. See this article on search and replace.
Enjoy your new handle! (I hope it sticks.)
Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started
Some additional steps to consider after making a change to your username on GitHub.
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
findandsedcommands, 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)git@github.com:username(Git config remote ssh URLs)travis-ci.com/username(Travis badges in READMEs)shields.io/github/.../username(Shields badges in READMEs, types includecontributors,stars,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.
Using find and sed can make these changes much faster. See this article on search and replace.
Enjoy your new handle! (I hope it sticks.)
Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started
Вопрос:
Я хотел бы изменить имя моей учетной записи github, я нашел опцию в настройках учетной записи GitHub.
Тем не менее, я обеспокоен последствиями и хотел бы знать, что является лучшей стратегией изменения имени, учитывая, что у меня есть некоторые проекты, связанные с моей учетной записью.
До сих пор я придумал этот план:
- Изменить имя учетной записи в настройках GitHub
- Для каждой локальной папки проекта в файле .git/config обновляется удаленный “источник” URL-адреса нового
Будет ли это работать? Должны ли быть какие-либо дальнейшие шаги на компьютере, который содержит источники проекта? Каким будет влияние смены имени на тех, кто клонировал или разветкил мои проекты на GitHub?
Спасибо!
Лучший ответ:
1.) Вы должны изменить все удаленные адреса ваших проектов. Вы можете увидеть их через:
git remote -v
После этого удалите старые удаленные адреса:
git remote rm git@github.com:old_account/foo.git
наконец добавьте новый удаленный адрес:
git remote add origin git@github.com:new_account/foo.git
2.) Все ваши клонированные репозитории будут разорвать. Нет URL-перенаправления или чего-либо подобного. Вы можете изменить локальные клонированные репозитории, но другие должны указывать на новые параметры репо (например, на шаге 1).
Примечание. Развернутые репозитории Github работают без проблем.
Ответ №1
Недавно GitHub изменил систему переименования имени пользователя и теперь перенаправляет вас.
Из Что произойдет, когда я изменю свое имя пользователя? в справке GitHub:
На стороне GitHub все будет вести себя так, как если бы ваше новое имя пользователя всегда было вашим именем. Все ваши репозитории теперь будут принадлежать что новое имя и старое имя пользователя существенно больше не будут существовать. Это может занять несколько минут после начала изменения.
Ссылки на предыдущую страницу профиля, например https://github.com/previoususername, верните ошибку 404. Мы не можем установить перенаправление от старого имени пользователя к новому для ссылок, таких как @mentions.
Однако перенаправление настраивается для всех ваших репозиториев. Как веб, так и git доступ к старой папке продолжает функционировать и перенаправлять к новому имени пользователя.
Ответ №2
Я оставил script в моем ~/bin под названием git -reremote со следующим содержимым:
#!/bin/sh
old=richoH
new=richo
git remote -v | grep $old | while read name url type; do
newurl=`echo $url | sed -e "s/$old/$new/"`
git remote set-url $name $newurl
done
Это немного взломанный, но он работает достаточно хорошо, просто cd в репозиторий git и вызовите git reremote (после того, как убедитесь, что он в вашем $PATH, а также что вы исправили старые и новые переменные.
As a basic refresher for most working on multiple coding projects or git-scm hosted accounts changing from one git account to another begs the question:
How do I see or change my Git (or github) username (usually email address)?
How to show your Git username – the basics
Use one of these methods:
- git config -get [user.name | user.email]
- git config –list
- or, open your git config file directly
Let’s examine each of these show your git username basics:
#1 – Use the command, git config -get [user.name | user.email]
git config user.name
This returns
Christian Screen
And if you enter git config user.email from the terminal from anywhere with your git initiated directory such as
git config user.email
this will return
cscreen@aiteamsuperstars.com
#2 – Use the command, ‘git config –list’
This approach shows all of the key configurations from your git config file, so entering the command from the terminal:
git config --list
will return the following:
credential.helper=osxkeychain
user.name=Christian Screen
user.email=cscreen@aiteamsuperstars.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=https://github.com/aicglabs/datalakehouse.git
#3 – Use the ‘open your git config file directly’ approach via the terminal
If the above approaches for some reason did not work then open the file for reading/editing in your terminal window or favorite editor. Terminal window review and editing is recommended to avoid issues. Use the following command to view the global git settings:
vi ~/.gitconfig
This will open the VimEditor and your .gitconfig file should look something like this:
[user]
name = Christian Screen
email = cscreen@aiteamsuperstars.com
Since this is your ‘global’ git user information (using the user home director path, ~/) you could have a different settings in other projects you might be working on.
NB: I find it best that if you have a specific project you are contributing to and need to use different credentials for the contribution, you should clone the project and then within the project use the command line to change your user.name and user.email just for that local git repository clone project to not impact your global settings. This would look like this from the command line (notice the –global is missing):
git config user.name "Christian Contribution Project"
git config user.email "christian@personalemail.com"
Read below if you’d like to see how to change your global Git username or email address.
How to change your Git username – the basics
Changing your Git username is fairly straightforward. In your terminal window enter the following:
git config --global user.name "Christian The Architect"
You can then view the change directly in the ~/.gitconfig file or just use the ~/.gitconfig file to edit the user.name key/value pair directly in the Vim Editor as you see here:
vi ~/.gitconfig
Since this is again your global Git config file, be sure edit it carefully. Remember in the Vi(m) Editor, use the ‘Esc’ key and then type ‘wq’ and then press the ‘Return’ or ‘Enter’ key to write/save the file and exit.
How to change your Git email address – the basics
You can change your email address with the same process and command as you would your username using these commands from the terminal:
git config --global user.email "cscreen@aiteamsuperstars.com"
View any of your global changes (those made with the –global flag) using either command below:
cat ~/.gitconfig
vi ~/.gitconfig
Hopefully you’ll have success remembering these basic Git commands.






