Open Robbert opened 8 years ago
We should try to find the $INSERT_KEY_HERE automatically
Work in progress attempt:
gpg --list-keys --with-colons gpg "`git config --global user.email`" | grep '^pub:[[:alpha:]]:[[:digit:]]\{4\}:1:[[:alnum:]]\{8\}\([[:alnum:]]\{8\}\)'
git config
to automatically look for the e-mail address for git commits.--with-colons
makes the output more easily parseable.OK, it turns out there is a very simple UNIX utility called cut
that can find values delimiter separated columns, CSV for example, but also values from colon separated columns.
Using that now:
gpg --with-colons --list-keys $GIT_COMMITTER_EMAIL \
grep ^pub | # Show only public keys
sort | # Sort by key strength
tail -n 1 | # Only use the strongest key (from the last line)
cut -d : -f 5 | # Only output the key ID column
grep -o "\([[:alnum:]]\)\{8\}$" # Only output the last eight characters
@Yolijn Would you please also setup GPG on your computers?
gpg
command line utility, if you don't have it already.GPG Keychain
and setup a new private key for the e-mail address you use for commits to Git.git config --global user.signingkey $INSERT_KEY_HERE
git config commit.gpgsign true
.gpg --list-keys
and then usinggpg --armor --export $INSERT_KEY_HERE
.Related reading: Github: Generating a GPG key