Search in this blog

Showing posts with label keypair. Show all posts
Showing posts with label keypair. Show all posts

Thursday, June 22, 2017

Generate GPG key pair for git commits

Use command:
$ gpg --gen-key
Select default options (or specify other).

  • Select what kind of key you want: (1) RSA and RSA (default).
  • RSA keys may be between 1024 and 4096 bits long.
  • Please specify how long the key should be valid: 0 = key does not expire.

Then enter your real name, email address and comment.
Then we need to generate a lot of random bytes for entropy. Load computer with disk operations to provide random number generator a better chance to gain enough entropy.
Wait while public and secret keys will be created.

List keys:
$ gpg --list-keys
/home/username/.gnupg/pubring.gpg
-----------------------------------
pub   2048R/9DA4A3D1 
...

Configure the key before using it for single repository, or globally if you are going to use the same key for every repository:
$ git config user.signingkey 9DA4A3D1 
$ git config --global user.signingkey 9DA4A3D1

Done.