GitHub Enterprise uses the email address you set in your local Git configuration to associate commits with your GitHub Enterprise account.

Setting your local Git email address using the git config command

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

  1. Open TerminalTerminalGit Bash.

  2. Set your email address with the following command:

    git config --global user.email "your_email@example.com"
    
  3. 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.

  1. Open TerminalTerminalGit Bash.

  2. Change the current working directory to the local repository in which you want to set your Git config email.

  3. Set your email address with the following command:

    git config user.email "your_email@example.com"
    
  4. 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. After adding your email, commits that used that email address will automatically be counted in your contributions graph. There is no limit to the number of email addresses you can add to your account.

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