Sublime Forum

How to sign commits

#1

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

(Not GPG, that works)

0 Likes

#2
$ git config commit.gpgSign true
0 Likes

#3

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

0 Likes

#4

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).

0 Likes

#5

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

0 Likes

#6

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?

3 Likes

#7

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:
https://www.sublimemerge.com/docs/command_palette#user_entries

0 Likes

#8

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

1 Like

#9

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.

Details
https://git-scm.com/docs/SubmittingPatches#sign-off

0 Likes

#10

It will be great to have this feature, but until it’s implemented, it can be automated using git commit-msg hook:
https://stackoverflow.com/questions/15015894/git-add-signed-off-by-line-using-format-signoff-not-working/46536244#46536244

1 Like

#11

This feature would be much appreciated. [Sublime Merge.app]

0 Likes

#12

@joshmfrankel Thank you! I also saw your blog post about that as well.

0 Likes

#13

Because the trailer added by git commit -s is just a bit of text, I’ve created a text macro that automatically writes it out for me. If I just write -soff at the end of the body of my commit message, Typinator will transform it into Signed-off-by: Nick Anderegg <my@email>.

0 Likes