Skip to content

Instantly share code, notes, and snippets.

@gjreasoner
Last active January 20, 2022 01:00
Show Gist options
  • Save gjreasoner/71b74531969ec930fe0c806878a5dd7a to your computer and use it in GitHub Desktop.
Save gjreasoner/71b74531969ec930fe0c806878a5dd7a to your computer and use it in GitHub Desktop.
GPG Key Mac

Install dependencies

brew install gpg pinentry-mac

Temp hack

Because pinentry-mac didn't work for me, I replaced the default pinentry app with the following:

rm /usr/local/opt/pinentry/bin/pinentry
ln -s /usr/local/bin/pinentry-mac /usr/local/opt/pinentry/bin/pinentry

Allow the terminal to ask for gpg password

export GPG_TTY=$(tty)

Add the following for ~/.gitconfig

[commit]
	gpgsign = true

# This is probably not necessary and should really be run with 
# git config --global gpg.program $(which gpg)
[gpg]
	program = /usr/local/bin/gpg

Generate key

gpg --full-generate-key

# From the option chose, option 1, RSA RSA
# Set key size 4096
# Also be sure to set an expiration date for like a 1year

Get public key

gpg --armor --export <your-email> | pbcopy

Add the gpg to gitlab

https://gitlab.com/-/profile/gpg_keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment