GitHub Enterprise uses the email address you set in your local Git configuration to associate commits with your GitHub Enterprise account.
git config
command
Setting your local Git email address using the The git config
command can be used to change your Git configuration settings,
including your email address. It takes two arguments:
- The setting you want to change--in this case,
user.email
. - Your new email address--for example,
your_email@example.com
. Be sure to use your own real, unique email address.
Your email address will be visible on commits to GitHub Enterprise. If you'd like to keep your email address private, set your Git config email to username@users.noreply.github.com
instead, replacing username
with your GitHub Enterprise username. For more information, see "Keeping your email address private".
Setting your email address for every repository on your computer
Open Terminal (for Mac and Linux users) or the command line (for Windows users).
-
Set your email address with the following command:
git config --global user.email "your_email@example.com"
-
Confirm that you have set your email address correctly with the following command.
git config --global user.email # your_email@example.com
Setting your email address for a single repository
You may need to set a different email address for a single repository, such as a work email address for a work-related project.
Open Terminal (for Mac and Linux users) or the command line (for Windows users).
Change the current working directory to the local repository in which you want to set your Git config email.
-
Set your email address with the following command:
git config user.email "your_email@example.com"
-
Confirm that you have set your email address correctly with the following command.
git config user.email # your_email@example.com
Setting your Git config email will not change the email address used for past commits, nor is it the same as adding your email address to your GitHub Enterprise account.
Troubleshooting
Commits on GitHub Enterprise aren't linking to my account
Make sure that the email address you set in your local Git configuration has been added to your GitHub Enterprise account's email settings. There is no limit to the number of email addresses you can add to your account.
Commits that are pushed after adding the new email address to your account will automatically be counted in your contribution graph. Past commits might not be counted, however. To have your previous contributions backfilled on GitHub Enterprise, you may need to contact your GitHub Enterprise site administrator, respectively.
Changing your email address in your local Git configuration settings only affects commits that you make after that change. Old commits will still be associated with the old email address.
New commits aren't using the right email
If git config user.email
reports the correct email address for the repository you're viewing,
but your commits are using the wrong email address, your environment variables may
be overriding your email address.
Make sure you have not set the GIT_COMMITTER_EMAIL
or GIT_AUTHOR_EMAIL
variables.
You can check their values with the following command:
echo $GIT_COMMITTER_EMAIL # prints the value of GIT_COMMITTER_EMAIL echo $GIT_AUTHOR_EMAIL # prints the value of GIT_AUTHOR_EMAIL
If you notice a different value, you can change it like so:
GIT_COMMITTER_EMAIL=your_email@example.com GIT_AUTHOR_EMAIL=your_email@example.com
Further reading
- "Keeping your email address private"
- "Git Configuration" from the Pro Git book