-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Support unsetting signing commits #252263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this looks good! Maybe just double-check that tests cover all cases.
@@ -1866,6 +1866,8 @@ export class Repository { | |||
|
|||
if (opts.signCommit) { | |||
args.push('-S'); | |||
} else if (opts.signCommit === false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of args.unshift('-c', 'commit.gpgSign=false'); is the right way to temporarily disable commit signing for this single git command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at Stackoverflow too - How to disable git gpg signing.
I do believe it should work and passing -c commit.gpgSign=false
on the command line overrides any global or local Git configuration and disables gpg signing for that single git commit.
To test this:
Make a commit normally and check that it's signed. Then, make a commit with signing disabled (using the new option) and check that it's not signed. The first commit should have a valid gpg signature whilst the second one should have no signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works as expected for me 🚀
Fixes #252261