Rust项目GPG签名配置指南
一、环境准备
winget install -e --id GnuPG.Gpg4win
二、密钥生成与配置
gpg --full-generate-key
gpg --list-secret-keys --keyid-format LONG
git config --global user.signingkey 076FC8A4D6CBBD0D
git config --global commit.gpgsign true
三、GitHub集成
gpg --armor --export 076FC8A4D6CBBD0D | clip
- 登录GitHub网页端
- 访问 https://github.com/settings/keys
- 点击"New GPG key"粘贴公钥
四、项目签名操作
git tag -s v0.1.0 -m "首个稳定版"
git push origin v0.1.0 --force
git tag -v v0.1.0
五、常见问题解决
1. 密钥导出失败
gpg --armor --export 076FC8A4D6CBBD0D > public_key.asc
2. 多账号配置
git config user.name "text"
git config user.email "xxxxx@163.com"
3. 路径问题修复
git config --global gpg.program "C:\\Program Files (x86)\\GnuPG\\bin\\gpg.exe"
六、Cargo.toml配置参考
[package]
name = "ll"
version = "0.1.0"
authors = ["xxxx"]
license = "MIT"
repository = "https://github.com/xxxx/xxx"[dependencies]
clap = { version = "4.5.37", features = ["derive"] }