2 years ago

#53576

test-img

Patrick Kenny

How can I sign git commits using GPG without changing the time of the commits in github?

I didn't know about commit signing before, so I have a repo with a few thousand commits that I would like to sign.

This question about signing previous commits has several answers, but they change the date/time of the commit, which I would like to keep.

I understand that to sign all commits, I have to rewrite the commit history, so the commit hashes will change; that is fine. But I hope there is a way to do it without changing the date/time of each commit-- after all, I just want to sign the commits and not make any other changes.

This answer on a different question shows a way to update the date of all commits but it doesn't sign them. And this answer to the originally linked question describes a way to preserve the commit date, which is what I want, but when I run the code

git rebase --committer-date-is-author-date -i --root

I get the error:

fatal: cannot combine am options with either interactive or merge options

This repository is on GitHub and has a simple structure with only two branches (main/dev) and a few thousand commits. How can I automatically sign all the commits while preserving the commit dates/times?

git

github

gnupg

0 Answers

Your Answer

Accepted video resources