Description
Is your feature request related to a problem? Please describe.
It not related with any problem, just a feature.
Describe the solution you'd like
Using GPG or S/MIME created sign tags and commits, and marked commits to GitHub Pages branch as verified on GitHub like this:
git config --global user.signingkey '<KEYID>'
git config --global commit.gpgsign true
Anyway, the gpg_private_key
should be added before creating the commits.
This would be a awesome feature and it may not quite easy as I thought at beginning , so I add some contents here:
- Export GPG private key on local machine with an ascii armored version which could be added as secrets in repository settings page:
gpg --output '<gpg_private_key.pgp>' --armor --export-secret-key '<username@email>'
- Import the exported key to remote GitHub Actions machine, the passphrase must be confirmed, so there are two variables required -
gpg_private_key.pgp
andpassphrase
:
gpg --import '<gpg_private_key.pgp>' --passphrase '<passphrase>' #this '--passphrase' may not working as excepted
I'm not sure whether a chmod
should be applied to the key file, but if it successfully added, the output is like this:
gpg: key KEYID: "KEY_USER_NAME (GitHub GPG Key) <KEY_USER_EMAIL>" not changed
gpg: key KEYID: secret key imported
gpg: Total number processed: 1
gpg: unchanged: 1
gpg: secret keys read: 1
gpg: secret keys imported: 1
The KEYID
could be extracted by regex.
- Add GPG KEYID to
.gitconfig
and enable auto signing when perform a commit:
git config --global user.signingkey '<KEYID>'
git config --global commit.gpgsign true
I have not confirmed whether the user.name
and user.email
in git config should be as same as the key's, or it does not match may cause signing error.
- Commit changes and push to branch:
git add -A
git commit -a -S -m "some message"
Here also requires the passphrase
to be entered and I got puzzled in passing the passphrase
directly to gpg form git in command line. Lastly git push
as usual.
- Should the GPG key to be removed after this step?
Additional context
Ref:
Add issues may did some help: