Last active
May 17, 2021 10:00
-
-
Save Fleshgrinder/5906809e5fdb3b4bd90076891d34cc2f to your computer and use it in GitHub Desktop.
Create GPG Key for GitHub Commit Signing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
# | |
# Commands for generating a new GPG key for GitHub commit signing. | |
# | |
# https://help.github.com/articles/generating-a-new-gpg-key/ | |
# | |
gpg --full-gen-key | |
# 1. 1 | |
# 2. 4096 | |
# 3. 1y | |
# 4. Richard Fussenegger | |
# 5. [email protected] | |
# 6. GitHub | |
# 7. **************************************** | |
id=$(gpg --list-keys --keyid-format LONG | grep -Eoe'4096R/([A-Z0-9]+)' -m1 --color=never | cut -d/ -f2) | |
gpg --armor --export $id >public.key | |
gpg --armor --export-secret-key $id >private.key | |
printf 'Add %s as signingkey to your global .gitconfig file\n' $id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
--full-gen-key
was needed on my system to be asked about the key size