在GitHub上更改用户名后,需要考虑一些其他步骤。 (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.
这是第238947234号,可能也是最后一次更改用户名(婚姻是永久的,对吗?),我想我最好写一篇简短的文章,介绍如何尽可能顺利地实现这种过渡。 您可以在此处阅读有关如何更改GitHub用户名的官方说明 ,它们会告诉您如何进行操作以及会发生什么情况。 以下是一些事后考虑的快速指南。
在哪里进行更改 (Where to make changes)
Change username in GitHub account settings.
在GitHub帐户设置中更改用户名。
- If using GitHub Pages, change name of your “username.github.io” repository. 如果使用GitHub Pages,请更改“ username.github.io”存储库的名称。
- If using other services that point to your “username.github.io” repository address, update them. 如果使用其他服务指向您的“ username.github.io”存储库地址,请对其进行更新。
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.)
如果使用Netlify,则可能要登录并重新连接存储库。 (我的仍在工作,但由于可能不相关的问题,我并不乐观。)
- Sign in to Travis CI and other integrations (find them in your repository Settings tab -> Integrations & services). This will update your username there. 登录到Travis CI和其他集成(在存储库的“设置”选项卡->“集成和服务”中找到它们)。 这将在那里更新您的用户名。
Update your local files and repository links with very carefully executed
find
andsed
commands, and push back changes to GitHub.使用非常仔细执行的
find
和sed
命令更新本地文件和存储库链接,并将更改推回GitHub。- Redeploy any websites you may have with your updated GitHub link. 使用更新的GitHub链接重新部署您可能拥有的任何网站。
- Fix any links around the web to your profile, your repositories, or Gists you may have shared. 将网上的任何链接修复到您可能已共享的个人资料,存储库或Gist。
本地文件更新 (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)github.com/username
(在自述文件或网站副本中引用您的GitHub页面)username.github.io
(Links to your GitHub Page)username.github.io
(链接到您的GitHub页面)git@github.com:username
(Git config remote ssh URLs)git@github.com:username
(Git配置远程ssh URL)travis-ci.com/username
(Travis badges in READMEs)travis-ci.com/username
(自述文件中的Travis徽章)shields.io/github/.../username
(Shields badges in READMEs, types includecontributors
,stars
,tags
, and more)shields.io/github/.../username
(自述文件中的Shields徽章,类型包括contributors
,stars
,tags
等)
You can quickly identify where the above strings are located using this command for each string:
您可以使用以下命令为每个字符串快速识别上述字符串的位置:
grep -rnw -e 'foobar'
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.
这将递归( r
)在所有文件中搜索与提供的整个( w
)模式( e
)相匹配的字符串,并在结果的前面加上行号( n
),以便您轻松找到它们。
Using find
and sed
can make these changes much faster. See this article on search and replace.
使用find
和sed
可以使这些更改更快。 请参阅有关搜索和替换的文章 。
Enjoy your new handle! (I hope it sticks.)
享受您的新手柄! (我希望它能坚持下去。)
翻译自: https://www.freecodecamp.org/news/a-quick-guide-to-changing-your-github-username/