How to cryptographically sign all commits on a branch?

I have a PGP key that allows me to sign commits through git commit -S. To sign my last commit, I did git commit -S --amend --no-edit, and he signed my commit.

Now I want to sign all the commits that are in the branch filtered.

I tried: git filter-branch --commit-filter 'git commit -S --amend --no-edit'

and this gives me an error message:

$ git filter-branch --commit-filter 'git commit --amend --no-edit -S' HEAD
Rewrite 07b0ac12f5fe1d8963d7ae0ac7fbda50cb6e74a9 (1/10)gpg: skipped "Anubhav Saini <IAmAnubhavSaini@users.noreply.github.com>": secret key not available
gpg: signing failed: secret key not available
error: gpg failed to sign the data
fatal: failed to write commit object
could not write rewritten commit

Another problem: raising another git commit --amend --no-edit -Sleads to:

(filter-test)$ git commit -S --no-edit --amend

You need a passphrase to unlock the secret key for
user: "Anubhav Saini <iamanubhavsaini@gmail.com>"

[filter-test c5ea180] Removing defer and async from scripts
 4 files changed, 28 insertions(+), 28 deletions(-)

Questions

  • How to sign commit messages?
  • What raises another sign, acting in fact and behind the scenes?
+4
source share
2 answers

Consider rewriting a story to sign all commits in a branch might be unnecessary.

- git . ( , ), , , .

, . git , SHA-1 . , , ( , git log, git checkout, git fsck .. ) .

, , git merge --squash git rebase -i .

+1

, gpg-agent - ( ). . Arch wiki . , , , gpg .

0

All Articles