Sublime Forum

How to sign commits


How can I git commit -s automatically for every new commit? Can this be specified per project?

(Not GPG, that works)


$ git config commit.gpgSign true


Sorry no. I’m not asking about GPG signing. I have that set up. I want the git commit -s type of signing.



The format.signoff git config option enables adding a signoff on patches automatically, but I don’t think it applies to commits in general just based on the name and the description.

The command line equivalent of what you want would be to set up a git alias that runs commit -s for you along with getting used to using the alias instead of git commit. You can set up custom git commands in Merge (i.e. call git with whatever argument you want) but I don’t know how well that would play with the GUI (my guess would be not well).



Has anyone figured out a good way to get Sublime Merge to sign commits?



This is a pretty big annoyance for me too.

It would really nice if they could just have a “commit and sign-off” option under the commit button (like they have the “amend previous commit” option) which would just add -s to the git commit -q -m "..." command that’s already there.

Another alternative that would be convenient would be to have a button in the commit message editor that would add your sign-off to the end of the current message for you, but I don’t see that as being better than using git’s own -s option.

Is there a better place to request a feature like this?



Is there a config option for Sublime Merge that could append options to the Git Commands? I need to try it with the Push, and Stash stuff.

The closest I can think is to do something similar to this:



Has anyone figured out a good way to get Sublime Merge to sign commits?

@Predatorian3 If you’re talking about GPG signing then you can use what FichteFoll suggested:

git config commit.gpgSign true

to enable automatic signing of commits.

Then if you wanted your signingkey to be used automatically in your config:

git config user.signingkey XXXXXXXXXXXXXXXX

To get this working with Sublime Merge, I’ve found adding no-tty to your ~/.gnupg/gpg.conf file gets the job done. I just wrote a blog post about this exact topic here: Signing commits for Github and Sublime Merge



I also find Sublime Merge’s lack of support for the DCO signature functionality problematic as I need this for several projects.

Please add support for automatically adding the --signoff flag in the commands by default.

This is not gpg but text added to each commit note as documented here.
Git can automate this with the --signoff flag, but there is no configuration to do it automatically without the flag.




It will be great to have this feature, but until it’s implemented, it can be automated using git commit-msg hook: