eda392a4a43c639a07e37daff134c597abef6b40
[releng/builder.git] / docs / signing.rst
1 Steps to sign your commits to Gerrit:
2
3 0.) Generate your GPG key. See:
4     https://lists.opendaylight.org/pipermail/tsc/2015-April/002841.html
5     Note: the *s around the non commented lines are just to indicate
6           it's a command at the CLI.
7
8 0.5) Install gpg, instead of or addition to gpg2. It appears as though
9      gpg2 has annoying things that it does when asking for your
10      passphrase, which I haven't debugged yet.
11      Note: you can tell git to use gpg by doing:
12            git config --global gpg.program gpg2
13            but that then will seem to struggle asking for your
14            passphrase unless you have your gpg-agent set up right.
15
16 1.) Add you GPG to Gerrit
17     a.) https://git.opendaylight.org/gerrit/#/settings/gpg-keys
18     b.) gpg --export -a <fingerprint> // e.g., gpg --export -a F566C9B1
19     c.) copy that output and paste it into the box and click add
20
21 3.) Set up your git to sign commits and push signatures
22     a.) git config commit.gpgsign true
23         Note: you can do this instead with git commit -S
24     b.) git config push.gpgsign true
25         Note: you can do this instead with git push --signed
26     c.) git config user.signingkey <fingerprint>
27         // e.g., git config user.signingkey F566C9B1
28
29 4.) Commit and push a change
30     a.) change a file
31     b.) git commit -asm "test commit"
32         Note: this should result in git asking you for your passphrase
33     c.) git review
34         Note: this should result in git asking you for your passphrase
35         Note: annoyingly, the presence of a gpgp signature or pushing
36               of a gpg signature isn't recognized as a "change" by
37               Gerrit, so if you forget to do either, you need to change
38               something about the commit to get Gerrit to accept the
39               patch again. Slightly tweaking the commit message is a
40               good way.
41         Note: this assumes you have git review set up and push.gpgsign
42               set to true. Otherwise:
43
44               git push --signed gerrit HEAD:refs/for/master
45               Note: this assumes you have your gerrit remote set up, if
46                     not it's something like:
47                     ssh://ckd@git.opendaylight.org:29418/<repo>.git
48                     where repo is something like docs or controller
49
50 5.) Verify that your commit is signed by going to the change in Gerrit
51     and checking for a green check (instead of a blue ?) next to your
52     name.