175c33a01SJonathan CorbetConfiguring Git
275c33a01SJonathan Corbet===============
39727a014STobin C. Harding
49727a014STobin C. HardingThis chapter describes maintainer level git configuration.
59727a014STobin C. Harding
675c33a01SJonathan CorbetTagged branches used in pull requests (see
775c33a01SJonathan CorbetDocumentation/maintainer/pull-requests.rst) should be signed with the
875c33a01SJonathan Corbetdevelopers public GPG key. Signed tags can be created by passing
975c33a01SJonathan Corbet``-u <key-id>`` to ``git tag``. However, since you would *usually* use the same
1075c33a01SJonathan Corbetkey for the project, you can set it in the configuration and use the ``-s``
1175c33a01SJonathan Corbetflag. To set the default ``key-id`` use::
129727a014STobin C. Harding
139727a014STobin C. Harding	git config user.signingkey "keyname"
149727a014STobin C. Harding
1575c33a01SJonathan CorbetAlternatively, edit your ``.git/config`` or ``~/.gitconfig`` file by hand::
169727a014STobin C. Harding
179727a014STobin C. Harding	[user]
189727a014STobin C. Harding		name = Jane Developer
199727a014STobin C. Harding		email = jd@domain.org
209727a014STobin C. Harding		signingkey = jd@domain.org
219727a014STobin C. Harding
2275c33a01SJonathan CorbetYou may need to tell ``git`` to use ``gpg2``::
239727a014STobin C. Harding
249727a014STobin C. Harding	[gpg]
259727a014STobin C. Harding		program = /path/to/gpg2
269727a014STobin C. Harding
2775c33a01SJonathan CorbetYou may also like to tell ``gpg`` which ``tty`` to use (add to your shell
2875c33a01SJonathan Corbetrc file)::
299727a014STobin C. Harding
309727a014STobin C. Harding	export GPG_TTY=$(tty)
3129108490SLinus Walleij
3229108490SLinus Walleij
3329108490SLinus WalleijCreating commit links to lore.kernel.org
3429108490SLinus Walleij----------------------------------------
3529108490SLinus Walleij
36*3afd89a4SJakub KicinskiThe web site https://lore.kernel.org is meant as a grand archive of all mail
3729108490SLinus Walleijlist traffic concerning or influencing the kernel development. Storing archives
3829108490SLinus Walleijof patches here is a recommended practice, and when a maintainer applies a
3929108490SLinus Walleijpatch to a subsystem tree, it is a good idea to provide a Link: tag with a
4029108490SLinus Walleijreference back to the lore archive so that people that browse the commit
4129108490SLinus Walleijhistory can find related discussions and rationale behind a certain change.
4275c33a01SJonathan CorbetThe link tag will look like this::
4329108490SLinus Walleij
4429108490SLinus Walleij    Link: https://lore.kernel.org/r/<message-id>
4529108490SLinus Walleij
4629108490SLinus WalleijThis can be configured to happen automatically any time you issue ``git am``
4775c33a01SJonathan Corbetby adding the following hook into your git::
4829108490SLinus Walleij
4929108490SLinus Walleij	$ git config am.messageid true
5029108490SLinus Walleij	$ cat >.git/hooks/applypatch-msg <<'EOF'
5129108490SLinus Walleij	#!/bin/sh
5229108490SLinus Walleij	. git-sh-setup
532bb19e74SJohannes Berg	perl -pi -e 's|^Message-I[dD]:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
5429108490SLinus Walleij	test -x "$GIT_DIR/hooks/commit-msg" &&
5529108490SLinus Walleij		exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
5629108490SLinus Walleij	:
5729108490SLinus Walleij	EOF
5829108490SLinus Walleij	$ chmod a+x .git/hooks/applypatch-msg
59