Git Setup Notes

Set the right email address before committing

git config user.email "youremail@yourdomain.com"
git config user.name "Your Name"

Try to avoid merge commits

git config --local branch.autosetuprebase always
git config --local merge.ff only

Configure signed git commits

Assuming you have Homebrew installed:

git config --local commit.gpgsign true
brew update
brew upgrade
brew uninstall gpg
brew install gpg2
git config --local gpg.program /usr/local/bin/gpg
git config --local commit.gpgsign true

Then after gpg has been installed, create a key:

gpg --full-generate-key

Then show all keys:

gpg --list-keys

Then copy the long number of your key into the clipboard and register it as follows:

git config --local user.signingkey <Key from your list>

Then tell GitHub know what your key is by first exporting it (copy the output — with START and END line included — into the clipboard):

gpg --armor --export <Key from your list>

Then add this key to GitHub at GPG keys: https://github.com/settings/keys

Your commits should now work and be signed.

Check GitHub docs for other options.

References