Git Configuration (.gitconfig)

This is important to get right, as you alternate between working on your personal projects using your personal email, and work projects using your work email.

Main thread to look at, this is exactly my issue:


Does the SSH key determine the author?

SSH or HTTP authentication is only used to check permission to push and have no correlation with commit authoring (unlike centralized VCS like CVS or SVN). Source

To sanity check, run

git config
git config

This should print out the desired name and email.

To set them up locally, run

git config "Your Name"
git config ""

If you want something global, use the ~/.gitconfig file, or you do something like

git config --global "Your Name"
git config --global ""

Which adds it to the config file.

How does this work with GitLab?

GitLab/GitHub will use the committer email to link commit author to GitHub/GitLab account.

Um, so what happens if the email is incorrect? Read more here

  • I am pretty sure GitLab/GitHub will just reject the commit, since it is linked to an invalid user, also see this

Apparently, you can also set your email to be private: