Debian Codegraph @

Documentation/translations/zh_CN/maintainer/configure-git.rst

raw
1 .. include:: ../disclaimer-zh_CN.rst
2
3 :Original: Documentation/maintainer/configure-git.rst
4
5 :译者:
6
7 吴想成 Wu XiangCheng <[email protected]>
8
9 .. _configuregit_zh:
10
11 Git配置
12 =======
13
14 本章讲述了维护者级别的git配置。
15
16 Documentation/maintainer/pull-requests.rst 中使用的标记分支应使用开发人员的
17 GPG公钥进行签名。可以通过将 ``-u`` 标志传递给 ``git tag`` 来创建签名标记。
18 但是,由于 *通常* 对同一项目使用同一个密钥,因此可以设置::
19
20 git config user.signingkey "keyname"
21
22 或者手动编辑你的 ``.git/config`` 或 ``~/.gitconfig`` 文件::
23
24 [user]
25 name = Jane Developer
26 email = [email protected]
27 signingkey = [email protected]
28
29 你可能需要告诉 ``git`` 去使用 ``gpg2``::
30
31 [gpg]
32 program = /path/to/gpg2
33
34 你可能也需要告诉 ``gpg`` 去使用哪个 ``tty`` (添加到你的shell rc文件中)::
35
36 export GPG_TTY=$(tty)
37
38
39 创建链接到lore.kernel.org的提交
40 -------------------------------
41
42 http://lore.kernel.org 网站是所有涉及或影响内核开发的邮件列表的总存档。在这里
43 存储补丁存档是推荐的做法,当维护人员将补丁应用到子系统树时,最好提供一个指向
44 lore存档链接的标签,以便浏览提交历史的人可以找到某个更改背后的相关讨论和基本
45 原理。链接标签如下所示:
46
47 Link: https://lore.kernel.org/r/<message-id>
48
49 通过在git中添加以下钩子,可以将此配置为在发布 ``git am`` 时自动执行:
50
51 .. code-block:: none
52
53 $ git config am.messageid true
54 $ cat >.git/hooks/applypatch-msg <<'EOF'
55 #!/bin/sh
56 . git-sh-setup
57 perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
58 test -x "$GIT_DIR/hooks/commit-msg" &&
59 exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
60 :
61 EOF
62 $ chmod a+x .git/hooks/applypatch-msg