git it is easy to overwrite someone as author or commit as someone else. Then how do you know it was someone who committed the changes?
That’s where the gpg signing comes into picture.
this is my first gpg signed post
One thing to note is that once you have generated gpg keys from
git bash then you can’t use them from windows command prompt. I found it rather handy to install gnugpg and then generating keys with gpg.
One thing i had to setup explicitly is to tell
git where to find
gpg so it asks me
passcode . Anyway the command is:
git config --global gpg.program "C:\GnuPG\bin\gpg.exe"
A few links of interest around this topic:
- A git horror story: Repository Integrity With Signed Commits
Anyway the most interesting is this:
Anyway, here is how to generate a gpg signature on
$ gpg --gen-key gpg (GnuPG) 1.4.22; Copyright (C) 2015 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. gpg: directory `/c/Users/sarang/.gnupg' created gpg: new configuration file `/c/Users/sarang/.gnupg/gpg.conf' created gpg: WARNING: options in `/c/Users/sarang/.gnupg/gpg.conf' are not yet active during this run gpg: keyring `/c/Users/sarang/.gnupg/secring.gpg' created gpg: keyring `/c/Users/sarang/.gnupg/pubring.gpg' created Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) Your selection? 1 RSA keys may be between 1024 and 4096 bits long. What keysize do you want? (2048) 4096 Requested keysize is 4096 bits Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) y You need a user ID to identify your key; the software constructs the user ID from the Real Name, Comment and Email Address in this form: "Heinrich Heine (Der Dichter) <email@example.com>" Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O You need a Passphrase to protect your secret key. We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. .+++++ ..............+++++ We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. +++++ ...+++++ gpg: /c/Users/sarang/.gnupg/trustdb.gpg: trustdb created gpg: key 67756F47 marked as ultimately trusted public and secret key created and signed. gpg: checking the trustdb gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u pub 4096R/67756F47 2018-02-16 Key fingerprint = 0300 88C3 84F8 D046 3214 A715 2B2A 845D 6775 6F47 uid Sarang Baheti <firstname.lastname@example.org> sub 4096R/05A5640E 2018-02-16