Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Support unsetting signing commits #252263

wants to merge 1 commit into from

Conversation

alexr00
Copy link
Member

@alexr00 alexr00 commented Jun 24, 2025

Fixes #252261

@alexr00 alexr00 self-assigned this Jun 24, 2025
@joaomoreno joaomoreno requested a review from lszomoru June 24, 2025 07:55
Copy link

@DhruvTheDev1 DhruvTheDev1 left a 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) {

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.

Copy link

@DhruvTheDev1 DhruvTheDev1 left a 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.

Copy link
Member

@joshspicer joshspicer left a 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 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing { signCommit: false} to commit doesn't do anything
3 participants