sudo apt-get install gpa seahorse
brew install gpg
-
gpg --gen-key
-
gpg --list-secret-keys --keyid-format LONG
Output format example:
/home/username/.gnupg/secring.gpg
-------------------------------
sec 4096R/<LONG_KEY> 2016-08-11 [expires: 2018-08-11]
uid User Name <user.name@email.com>
ssb 4096R/62E5B29EEA7145E 2016-08-11
-
Copy the characters taking the position of
<LONG_KEY>
in the above template. This string of characters will be used a couple of times in the next set of commands. -
Run these git commands, replacing
<LONG_KEY>
with the copied string of characters from above.
git config --global user.signingkey <LONG_KEY>
git config --global commit.gpgsign true
- Copy the characters in the place of
<LONG_KEY>
above into this command which outputs the GPG key to the clipboard:
gpg --armor --export <LONG_KEY> | pbcopy
NOTE: Replace pbcopy
with xclip -sel clip
or equivalent for whatever other clipboard utility might be installed when using Linux.
- Navigate to Settings > Keys.
- Select
New GPG Key
, paste, and save.
NOTE: It's possible that you'll need to restart the gpg-daemon in order to get it to ask for the password.
One way to do this (on OSX, at least) is pkill "gpg-agent"
followed by gpg-agent --daemon
.
Edit your ~/.gnupg/gpg-agent.conf
file, pasting these two lines with <SECONDS>
replaced:
default-cache-ttl <SECONDS>
max-cache-ttl <SECONDS>
gpg --edit-key <PASTE_YOUR_KEY_ID_HERE>
At the gpg prompt type passwd
.
Type in the current passphrase when prompted.
Type in the new passphrase twice when prompted.
Type: save
.