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