This is a step-by-step guide on how to enable auto-signing Git commits with GPG for every applications that dont support it natively (eg. Login into and go to your settings, SSH and GPG Keys, and add your GPG key from the page. WINDOWS How to enable auto-signing Git commits with GnuPG for programs that dont support it natively.
The -armor option tells gpg to create an ASCII file. Step 17: Submit your PGP key to Github to verify your Commits The -encrypt option tells gpg to encrypt the file, and the -sign option tells it to sign the file with your details. You can enter it into the Dialog box-with the option of saving the password to the macOS X Keychain.
You will now be prompted by Pinentry for the password for your signing key. Step 15: Perform a Commit git commit -S -s -m "My Signed Commit" This tells Git to sign all commits using the key you specified in step 13. Step 14: Configure Git to sign all commits (Optional-you can configure this per repository too) The below command needs the fingerprint from step 10 above: git config -global user.signingkey 1111111 Step 13: Configure Git to use your signing key Step 12: Configure Git to use gpg git config -global gpg.program $(which gpg) The output from below is what you copy to Github: # The export command below gives you the key you add to GitHub In the output from step 10, the line below the row that says 'pub' shows a fingerprint-this is what you use in the placeholder. You need to copy the output similar to the example above where the # is. Use the next command to generate a short form of the key fingerprint.Ĭopy the text after the rsa4096/ and before the date generated and use the copied id in step 13: gpg -K -keyid-format SHORT You need a Passphrase to protect your secret key. You need a user ID to identify your key the software constructs the user IDįrom the Real Name, Comment and Email Address in this form:Ĭhange (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o Please specify how long the key should be valid. Once you have entered your options, pinentry will prompt you for a password for the new PGP key. You will need to modify the permissions to 700 to secure this directory. To do this, you'll want to export your public GPG key with its various identities and paste the armored data in GitHub.
Head on over to your Account page open in new window and you'll find a GPG keys section where you can add a new GPG key.
Step 7: Update the Permissions on your ~/.gnupg Directory That's where GitHub's support for GPG keys comes in very handy. Run the following command to generate your key, note we have to use the -expert flag so as to generate a 4096-bit key. Step 5: Restart your Terminal or source your ~/.*rc file source ~/.bashrc # Uncomment within config (or add this line)Īppend the following to your ~/.bashrc or ~/.zshrc. Step 3: Update or Create ~/.gnupg/gpg.conf Pinentry-program /usr/local/bin/pinentry-mac We use the Homebrew package manager for this step.