File tree 1 file changed +27
-2
lines changed
1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -422,9 +422,25 @@ gh pr create
422
422
423
423
之后可以直接使用 `watch_latest_run` 命令即可。
424
424
425
- ### GPG 签名 {#github-gpg }
425
+ ### GPG 与 SSH 密钥签名 {#github-sign }
426
426
427
- SSH Key 只用来验证 push 环节的身份,而 GPG Key 则用来验证 Commit 的真实性。
427
+ 在默认配置下,SSH Key 只用来验证你是否有权限修改指定的仓库,但有些时候我们需要证明某个 commit 就是由你(而不是其他人)提交的,以验证 commit 的真实性,此时就需要对 commit ** 签名** 。GPG Key 和 SSH Key 都可以用来签名。
428
+
429
+ 在按照以下内容配置完成后,使用以下命令即可为 commit 和 tag 签名:
430
+
431
+ ``` shell
432
+ git commit -S ...
433
+ git tag -s ...
434
+ ```
435
+
436
+ 如果需要自动为所有 commit 和 tag 签名(不管是使用 GPG 还是 SSH 签名),则:
437
+
438
+ ``` shell
439
+ git config --global commit.gpgSign true
440
+ git config --global tag.gpgSign true
441
+ ```
442
+
443
+ #### GPG 签名 {#github-gpg}
428
444
429
445
GitHub 对 GPG Key 的文档描述很详细,我们将其列在这里:
430
446
@@ -448,6 +464,15 @@ gpg --keyserver pgp.mit.edu --send-keys <GPG Key ID>
448
464
在 GitHub 上 rotate 只需要删除旧的 GPG Key, 然后重新添加新的 GPG Key 即可.
449
465
值得注意的是过期的 GPG Key 签名的 commit 依然会显示成 Verified, 因此**不要轻易删除过期的 GPG Key**.
450
466
467
+ #### SSH 签名 {#github-ssh}
468
+
469
+ 在已经为账户添加了 SSH Key 的基础上,SSH 签名的配置就简单得多:
470
+
471
+ ``` shell
472
+ git config --global gpg.format ssh
473
+ git config --global user.signingkey ~ /.ssh/yourkey.pub
474
+ ```
475
+
451
476
### Issue {#github-issue}
452
477
453
478
下面关于 Markdown 的特性并不限于 Issue,也适用于 Pull Request 等。
You can’t perform that action at this time.
0 commit comments