⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@GideonBear
Copy link

@GideonBear GideonBear commented Dec 28, 2025

This fixes running tests when git config --global commit.gpgsign true:

error: gpg failed to sign the data:
gpg: skipped "test <[email protected]>": No secret key
[GNUPG:] INV_SGNR 9 test <[email protected]>
[GNUPG:] FAILURE sign 17
gpg: signing failed: No secret key

fatal: failed to write commit object

With this patch, the tests pass.
Other scenarios where the global config could cause problems in tests are thinkable as well. The tests should not rely on or use the global config at all.
Alternatively, we could do the following (which also works):

diff --git a/tests/make_repo_test.py b/tests/make_repo_test.py
index e874ef6..8ed7598 100644
--- a/tests/make_repo_test.py
+++ b/tests/make_repo_test.py
@@ -46,6 +46,7 @@ def in_git_dir(tmpdir):
     git_path = tmpdir.join('gits')
     subprocess.check_call(('git', 'init', git_path))
     with git_path.as_cwd():
+        subprocess.check_call(('git', 'config', 'commit.gpgsign', 'false'))
         yield git_path

But that seems like a worse solution.

@GideonBear GideonBear changed the title Ignore global config in tests Ignore global git config in tests Dec 28, 2025
@asottile
Copy link
Member

for the most part the only ones running these tests are myself and CI so in the past I've rejected similar patches

@asottile asottile closed this Jan 12, 2026
@GideonBear GideonBear deleted the disable-signing-in-tests branch January 12, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants