About commit email addresses
GitHub uses your commit email address to associate commits with your account on your GitHub Enterprise Server instance. You can choose the email address that will be associated with the commits you push from the command line as well as web-based Git operations you make.
For web-based Git operations, you can set your commit email address on your GitHub Enterprise Server instance. For commits you push from the command line, you can set your commit email address in Git.
After changing your commit email address on GitHub Enterprise Server, the new email address will be visible in all of your future web-based Git operations by default. Any commits you made prior to changing your commit email address are still associated with your previous email address.
To ensure that commits are attributed to you and appear in your contributions graph, use an email address that is connected to your account on your GitHub Enterprise Server instance. For more information, see "Adding an email address to your GitHub account."
Setting your commit email address on GitHub
-
在任何页面的右上角,单击个人资料照片,然后单击“设置”。
-
In the left sidebar, click Emails.
-
在“添� 电子邮件地址”中,输入� 的电子邮件地址并单击“添� ”。
-
在“Primary email address(主要电子邮件地址)”列表中,选择要与基于 web 的 Git 操作关联的电子邮件地址。
Setting your commit email address in Git
You can use the git config
command to change the email address you associate with your Git commits. The new email address you set will be visible in any future commits you push to your GitHub Enterprise Server instance from the command line. Any commits you made prior to changing your commit email address are still associated with your previous email address.
Setting your email address for every repository on your computer
- 打开终端终端Git Bash。
- 在 Git 中设置电子邮件地址。 可以使用任何电子邮件地址。
$ git config --global user.email "YOUR_EMAIL"
- 确认在 Git 中正确设置了电子邮件地址:
$ git config --global user.email email@example.com
- 将电子邮件地址添� 到 GitHub Enterprise Server 上的帐户,以便提交归属于� 并显示在� 的贡献图中。 有关详细信息,请参阅“将电子邮件地址添� 到 GitHub 帐户”。
Setting your email address for a single repository
GitHub Enterprise Server uses the email address set in your local Git configuration to associate commits pushed from the command line with your account on your GitHub Enterprise Server instance.
You can change the email address associated with commits you make in a single repository. This will override your global Git configuration settings in this one repository, but will not affect any other repositories.
- 打开终端终端Git Bash。
- Change the current working directory to the local repository where you want to configure the email address that you associate with your Git commits.
- 在 Git 中设置电子邮件地址。 可以使用任何电子邮件地址。
$ git config user.email "YOUR_EMAIL"
- 确认在 Git 中正确设置了电子邮件地址:
$ git config user.email email@example.com
- 将电子邮件地址添� 到 GitHub Enterprise Server 上的帐户,以便提交归属于� 并显示在� 的贡献图中。 有关详细信息,请参阅“将电子邮件地址添� 到 GitHub 帐户”。