使用 GPG 签署 git 提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10077996/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sign git commits with GPG
提问by austin1howard
Is there a way to sign git commits with gpg? It's so easy with tags (using -s
instead of -a
), it seems there would be a similar function for commits.
有没有办法用 gpg 签署 git 提交?使用标签(使用-s
而不是-a
)非常容易,似乎提交会有类似的功能。
采纳答案by wRAR
git commit -S
(requires git >= 1.7.9).
git commit -S
(需要 git >= 1.7.9)。
回答by VonC
Note: Adding the -S
option all the time can be cumbersome.
In git 2.0 and later, you can add a config which will take care of that option for you.
注意:一直添加-S
选项可能很麻烦。
在 git 2.0 及更高版本中,您可以添加一个配置来为您处理该选项。
See commit 2af2ef3by Nicolas Vigier (boklm):
见提交2af2ef3由尼古拉斯·Vigier(boklm) :
Add the commit.gpgsign
option to sign all commits
添加对commit.gpgsign
所有提交进行签名的选项
If you want to GPG sign all your commits, you have to add the
-S
option all the time.
Thecommit.gpgsign
config option allows to sign all commits automatically.
如果您想 GPG 签署您的所有提交,则必须
-S
始终添加该选项。
该commit.gpgsign
配置选项允许自动登录所有的提交。
commit.gpgsign
A boolean to specify whether all commits should be GPG signed.
Use of this option when doing operations such as rebase can result in a large number of commits being signed. It may be convenient to use an agent to avoid typing your GPG passphrase several times.
一个布尔值,用于指定是否所有提交都应该是 GPG 签名的。
在执行诸如 rebase 之类的操作时使用此选项可能会导致大量提交被签名。使用代理来避免多次输入 GPG 密码可能会很方便。
To set this globally on the command line:
要在命令行上全局设置它:
git config --global commit.gpgsign true
With Git 2.27 (Q2 2020), "git rebase
" learned the "--no-gpg-sign
" option to countermand commit.gpgSign
the user may have.
在 Git 2.27(2020 年第二季度)中,“ git rebase
”学会了“ --no-gpg-sign
”选项来撤销commit.gpgSign
用户可能拥有的选项。
See commit 5c5bac1, commit 4369d3a, commit 9da37fe, commit ae06ba6, commit cf0ad4d, commit c241371(03 Apr 2020) by ?oàn Tr?n C?ng Danh (``).
(Merged by Junio C Hamano -- gitster
--in commit fc3f6fd, 22 Apr 2020)
请参阅?oàn Tr?n C?ng Danh (``) 的提交 5c5bac1、提交 4369d3a、提交 9da37fe、提交 ae06ba6、提交 cf0ad4d、提交 c241371(2020 年 4 月 3 日)。
(由Junio C gitster
Hamano合并-- --在提交 fc3f6fd 中,2020 年 4 月 22 日)
cherry-pick/revert
: honour--no-gpg-sign
in all caseSigned-off-by: ?oàn Tr?n C?ng Danh
{cherry-pick,revert} --edit hasn't honoured --no-gpg-sign yet.
Pass this option down to
git commit
to honour it.
cherry-pick/revert
: 荣誉--no-gpg-sign
在所有情况下签字人:?oàn Tr?n C?ng Danh
{cherry-pick,revert} --edit 尚未兑现 --no-gpg-sign 。
将此选项传递给以
git commit
兑现它。