GPG签名配置

GPG签名配置

Tags
git
description
GPG签名
更新时间
Last updated January 28, 2022
git config --list 查看配置列表
添加配置项目:git config add
修改配置项目: git config 配置名称 值
删除配置项目: git config  [--system|--local|--global] --unset 配置名称
git config commit.gpgsign true 开启
git config commit.gpgsign false 关闭
git config --global user.email  [email protected] 全局配置 git 邮箱
git config --global user.name kaiguo 全局配置 git 用户名
  • -------------------
Mac os 安装 gpg
brew install gnupg (过程会比较慢)
notion image
gpg --full-generate-key 生成一个签名秘钥
notion image
填姓名和邮箱,注释不用填——确定--确定
notion image
gpg --list-keys (gpg --list-secret-keys)查看签名秘钥
notion image
配置
git config --global user.signingkey 99E8133067AB9A135039F3C14597859006EF478D
开启签名
git config commit.gpgsign true
代码 commit 提交之后 使用 GPG 签名的提交在 GitHub 的历史记录中显示为绿色的 Verified 字样,便于人们确定提交的确是由你提交的。
未配置 gpg 的情况下会显示如下:
notion image
notion image
这时候我们就要导出一个 GPG key 并导入到 github - settings GPG keys
gpg --export --armor [email protected] > mypubkey.asc
notion image
notion image
这时候再看带签名的 commit,确认一下是否 ok
notion image
==========end=========