我对GitHub/VCS很陌生。
当我尝试在GitHub上分享我的项目时,我得到了以下错误消息。
Can't finish GitHub sharing process
Successfully created project 'myproject' on GitHub, but initial push failed:
remote: error: GH007: Your push would publish a private email address.
failed to push some refs to 'https://github.com/me/myproject.git'
我用谷歌搜索了错误信息,没有结果。我还搜索了Stack Exchange,但一无所获。我该如何解决这个问题?
当启用“阻止命令行推送暴露我的电子邮件”功能时,您还需要配置Git以使用您的无回复电子邮件地址。别担心——这不会影响你的贡献图。所有提交仍将与您的帐户相关联。
Open Terminal.
Change the current working directory to the local repository where you want to configure the email address that you associate with your Git commits.
Find your GitHub noreply address in your GitHub's Personal Settings → Emails. It's mentioned in the description of the Keep my email address private checkbox. Usually, it starts with a unique identifier, plus your username.
Set an email address in Git. Use your GitHub-provided no-reply email address.
Setting your email address for every repository on your computer
git config --global user.email "{ID}+{username}@users.noreply.github.com"
Setting your email address for a single repository
git config user.email "{ID}+{username}@users.noreply.github.com"
Reset the author information on your last commit:
git commit --amend --reset-author
If you have multiple commits with your private e-mail address, see this answer.
Now you can push the commit with the noreply e-mail address, and future commits will have the noreply e-mail address as well.
git push
一旦你配置了Git,提交将使用你的备用“不回复”电子邮件地址,任何不这样做的推送都将被拒绝。