Tobin C. Harding | 9727a01 | 2017-12-04 10:27:29 +1100 | [diff] [blame] | 1 | .. _configuregit: |
| 2 | |
| 3 | Configure Git |
| 4 | ============= |
| 5 | |
| 6 | This chapter describes maintainer level git configuration. |
| 7 | |
| 8 | Tagged branches used in :ref:`Documentation/maintainer/pull-requests.rst |
| 9 | <pullrequests>` should be signed with the developers public GPG key. Signed |
| 10 | tags can be created by passing the ``-u`` flag to ``git tag``. However, |
| 11 | since you would *usually* use the same key for the same project, you can |
| 12 | set it once with |
| 13 | :: |
| 14 | |
| 15 | git config user.signingkey "keyname" |
| 16 | |
| 17 | Alternatively, edit your ``.git/config`` or ``~/.gitconfig`` file by hand: |
| 18 | :: |
| 19 | |
| 20 | [user] |
| 21 | name = Jane Developer |
| 22 | email = jd@domain.org |
| 23 | signingkey = jd@domain.org |
| 24 | |
| 25 | You may need to tell ``git`` to use ``gpg2`` |
| 26 | :: |
| 27 | |
| 28 | [gpg] |
| 29 | program = /path/to/gpg2 |
| 30 | |
| 31 | You may also like to tell ``gpg`` which ``tty`` to use (add to your shell rc file) |
| 32 | :: |
| 33 | |
| 34 | export GPG_TTY=$(tty) |
Linus Walleij | 29108490 | 2019-11-18 23:30:19 +0100 | [diff] [blame] | 35 | |
| 36 | |
| 37 | Creating commit links to lore.kernel.org |
| 38 | ---------------------------------------- |
| 39 | |
| 40 | The web site http://lore.kernel.org is meant as a grand archive of all mail |
| 41 | list traffic concerning or influencing the kernel development. Storing archives |
| 42 | of patches here is a recommended practice, and when a maintainer applies a |
| 43 | patch to a subsystem tree, it is a good idea to provide a Link: tag with a |
| 44 | reference back to the lore archive so that people that browse the commit |
| 45 | history can find related discussions and rationale behind a certain change. |
| 46 | The link tag will look like this: |
| 47 | |
| 48 | Link: https://lore.kernel.org/r/<message-id> |
| 49 | |
| 50 | This can be configured to happen automatically any time you issue ``git am`` |
| 51 | by adding the following hook into your git: |
| 52 | |
| 53 | .. code-block:: none |
| 54 | |
| 55 | $ git config am.messageid true |
| 56 | $ cat >.git/hooks/applypatch-msg <<'EOF' |
| 57 | #!/bin/sh |
| 58 | . git-sh-setup |
| 59 | perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1" |
| 60 | test -x "$GIT_DIR/hooks/commit-msg" && |
| 61 | exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} |
| 62 | : |
| 63 | EOF |
| 64 | $ chmod a+x .git/hooks/applypatch-msg |