目录
当前位置: 首页 > 文档资料 > Yubikey 使用手册 >

Git 签名 - Tags 签名

优质
小牛编辑
117浏览
2023-12-01

Tags 签名

假设你有一个额外的文件可以在主 ~/.gitconfig 中添加 gitconfig 设置:

  1. [include]
  2. path = .gitconfig.local

配置 ~/.gitconfig.local 文件让其指向你插入的 GPG 签名钥匙:

  1. [user]
  2. signingkey = <signingKeyId>

开启 git tag -m <message> 来自动强制签名 tags:

  1. [tag]
  2. forceSignAnnotated true

在临时项目上创建 tag 来测试签名钥匙是否工作正常:

  1. ❯ cd /tmp
  2. ❯ mkdir foo
  3. ❯ cd foo
  4. ❯ git init
  5. ❯ touch bar
  6. ❯ git add bar
  7. ❯ git ci -m "Add bar"
  8. ❯ git tag 1.0.0 -s -m "Release 1.0.0"

输入 Yubikey GPG PIN 然后触摸它,确保 GPG 签名已经被加入 tag 中:

  1. ❯ git show 1.0.0