Github Git & GPG survivor guide

Create and configure a GPG key

  1. Install gpg

See the Official page https://www.gnupg.org/download/

Or simply execute :

$> npn install gpg
  1. Create a GPG key

Execute the following command to obtain a RSA 4096 key :

$> gpg --full-generate-key --
  1. List generated Keys

$> gpg --list-secret-keys --keyid-format LONG

this will display something like :

/c/Users/frede/.gnupg/pubring.kbx
---------------------------------
sec   rsa4096/xxxxxxxxxxxxxxxx 2019-01-28 [SC]
    661197BA67DD26319139F5A2xxxxxxxxxxxxxxxx
uid                 [ultimate] John Doe (Github Signature) <john.doe@provider.ext>
ssb   rsa4096/yyyyyyyyyyyyyyy 2019-01-28 [E]
  1. export your key to a text

    $> gpg --armor --export xxxxxxxxxxxxxxxx

use the previously identified key (see the 16 ‘x’).

a similar text as bellow will appear :

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBFxPjpIBEACsYpfe6pxNKyIbH2eASJ5lxxuIbwxLpbJKrGXjFgoX8T0FONJL
BzOtMw1J89+MT6NVkDVzp7NtvS4G0cI+9pUVEcAmOsdtecTqHKxmoWeA4D4LgAF7
jtiKBgeuHLZSLYJMXwObXC+t7XsSwwq+H7vyMV8HBS24QOlYShw388QLzWDWqIXP
....
BGEljLjAxXagJkPg4pXZOsteBcQ/9EU5tDRM2Xoz/mKF4JJtM46lsn3/Ev6KjIkb
vcGLPKr2rY7jB4lzs/EkYXuc/B94eKcchIyqpg4f
=IOpT
-----END PGP PUBLIC KEY BLOCK-----
  1. Go to https://github.com/settings/keys

  2. Click on the [ New GPG key ] and copy and paste the extracted block,

    • starting with a -----BEGIN PGP PUBLIC KEY BLOCK-----
    • ending with a -----END PGP PUBLIC KEY BLOCK-----,

    to the text input.

Sign a git commit

to sign your commit with a GPG key, you must tell to your git project which GPG key to b used.

  1. add the GPG key to you git config

    $> git config --local user.signingkey xxxxxxxxxxxxxxxx

or to set globally your signing key :

$> git config --global user.signingkey xxxxxxxxxxxxxxxx
  1. Create a modif and commit it:

    $> git commit -S -m "feature(GPGSigning) add a GPG signature"

And that’s all folks

McG.

Publicités

Les commentaires sont fermés.

Créez un site Web ou un blog gratuitement sur WordPress.com.

Retour en haut ↑

%d blogueurs aiment cette page :