Github 提交命令时并没有验证邮箱的正确性, 也就是可以说邮箱是可以伪造的
如图所示 这里我随便用两个邮箱提交 都是可以的 但是为了避免这种情况的出现
可以使用 Verified( 认证)
首先要下载Gpg4win GPG 入门教程请访问:http://www.ruanyifeng.com/blog/2013/07/gpg.html
安装之后 打开Git bash
gpg --gen-key //gpg --full-generate-key
Real name:
Email address:
Comment://可空
等几分钟后
// gpg --list-keys
gpg --list-secret-keys --keyid-format LONG //查看key
git config --global user.signingkey 2DB291B39A986B19 //将 key 告知git
git config --global commit.gpgsign true //所有项目都启用签名验证
gpg --armor --export --生成的key 粘贴到github 或者码云上
git log --show-signature //查看签名信息
若在window 使用CMD 操作 会出现gpg 生成的文件会在 C:\Users\用户名\AppData\Roaming\gnupg 目录下
而git中在C:\Users\用户名\.gnupg 路径下 所以说要在git Bash 中生成 之后可以使用Kleopatra 导入方便查看
参考:
https://help.github.com/cn/articles/telling-git-about-your-signing-key