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