Sobes.tech
Junior — Middle

How can an error be fixed when pushing signed commits if old unsigned commits interfere?

sobes.tech AI

Answer from AI

If you encounter an error during a Git push due to unsigned old commits, but new commits are signed, you can resolve the issue with the following methods:

  1. Re-sign the old commits using an interactive rebase:
git rebase -i --exec 'git commit --amend --no-edit -n -S' <commit_before_old_commits>

This will re-sign all commits starting from the specified one.

  1. Perform a force push after re-signing:
git push --force
  1. If re-signing commits is inconvenient, you can disable the signature requirement for pushes, but this is not recommended.

Thus, to fix the error, you need to re-sign the old commits so that all commits in the branch are signed, and then perform a push.