Github 提交命令時並無驗證郵箱的正確性, 也就是能夠說郵箱是能夠僞造的 html
如圖所示 這裏我隨便用兩個郵箱提交 都是能夠的 可是爲了不這種狀況的出現git
能夠使用 Verified( 認證)github
首先要下載Gpg4win GPG 入門教程請訪問:http://www.ruanyifeng.com/blog/2013/07/gpg.htmlwindows
安裝以後 打開Git bashbash
gpg --gen-key //gpg --full-generate-key 操作系統
Real name: code
Email address: orm
Comment://可空htm
等幾分鐘後 blog
// 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 導入方便查看
例子:操做系統 win10 、Git 版本 git version 2.23.0.windows.1
打開Git Bash
gpg --full-generate-key //生成key
gpg --list-secret-keys --keyid-format LONG //查看生成的key
gpg --armor --export
copy 到Github
-----BEGIN PGP PUBLIC KEY BLOCK-----
若是你不想輸入每次輸入GPG 驗證密碼 能夠在 設置key 的時候選擇不輸入 以後提交就不會讓你輸入密碼了
參考:
https://help.github.com/cn/articles/telling-git-about-your-signing-key