Creating a GPG Key
Create and upload a GPG key.
Generating a GPG key¶
1. Install a GPG Command Line Tool¶
Download and install the GPG command line tools for your operating system.
2. Open Git Bash¶
3. Generate a GPG key pair¶
For version 2.1.17 or greater, use the following command.
- Follow the prompts to create the kind of key you want. I recommend using
an
RSA and RSAkey with a keysize of4096and setting the expiry to0. - Verify that your selections are correct.
- When prompted, type a secure passphrase. This can be anything, although I recommend against using spaces.
4. Find your key ID¶
List the long form of the GPG keys for which you have both a public and private key.
Note
Some GPG installations on Linux may require you to use gpg2 --list-keys
--keyid-format LONG to view a list of your existing keys instead. In this case
you will also need to configure Git to use gpg2 by running git config --global
gpg.program gpg2.
You'll see something like:
From the list of GPG keys, copy the long form of the GPG key ID you'd like to
use. In this example, your GPG key ID is ABC123DEF4567890.
5. Publish Your Public Key¶
Upload your key to a keyserver.
- Replace
ABC123DEF4567890with your actual key ID.
1. Install a GPG Command Line Tool¶
Download and install the GPG command line tools for your operating system.
2. Open Terminal¶
3. Generate a GPG key pair¶
For version 2.1.17 or greater, use the following command.
- Follow the prompts to create the kind of key you want. I recommend using
an
RSA and RSAkey with a keysize of4096and setting the expiry to0. - Verify that your selections are correct.
- When prompted, type a secure passphrase. This can be anything, although I recommend against using spaces.
4. Find your key ID¶
List the long form of the GPG keys for which you have both a public and private key.
Note
Some GPG installations on Linux may require you to use gpg2 --list-keys
--keyid-format LONG to view a list of your existing keys instead. In this case
you will also need to configure Git to use gpg2 by running git config --global
gpg.program gpg2.
You'll see something like:
From the list of GPG keys, copy the long form of the GPG key ID you'd like to
use. In this example, your GPG key ID is ABC123DEF4567890.
5. Publish Your Public Key¶
Upload your key to a keyserver.
- Replace
ABC123DEF4567890with your actual key ID.
1. Install a GPG Command Line Tool¶
Download and install the GPG command line tools for your operating system.
2. Open Terminal¶
3. Generate a GPG key pair¶
For version 2.1.17 or greater, use the following command.
- Follow the prompts to create the kind of key you want. I recommend using
an
RSA and RSAkey with a keysize of4096and setting the expiry to0. - Verify that your selections are correct.
- When prompted, type a secure passphrase. This can be anything, although I recommend against using spaces.
4. Find your key ID¶
List the long form of the GPG keys for which you have both a public and private key.
Note
Some GPG installations on Linux may require you to use gpg2 --list-keys
--keyid-format LONG to view a list of your existing keys instead. In this case
you will also need to configure Git to use gpg2 by running git config --global
gpg.program gpg2.
You'll see something like:
From the list of GPG keys, copy the long form of the GPG key ID you'd like to
use. In this example, your GPG key ID is ABC123DEF4567890.
5. Publish Your Public Key¶
Upload your key to a keyserver.
- Replace
ABC123DEF4567890with your actual key ID.