Skip to contentSkip to conversation

Support SSH user.signingkey

PATCH Applied Bingwu Zhang 2 participants 2 messages Mar 28 – Apr 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support SSH user.signingkey

From: Bingwu Zhang <[email protected]>

Check gpg.format to see if user.signingkey is a SSH key.

---
 src/patatt/__init__.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
src/patatt/__init__.py +6 -3
index ae8f21ea104f..ac610b87bc6d 100644
@@ -1312,10 +1312,13 @@ def get_algo_keydata(config: GitConfigType) -> Tuple[str, str]:
         return algo, keydata
 
     if not config.get('signingkey'):
-        if usercfg.get('signingkey'):
-            logger.info('N: Using pgp key %s defined by user.signingkey', usercfg.get('signingkey'))
+        user_signingkey = usercfg.get('signingkey')
+        if user_signingkey:
+            gpg_format = get_config_from_git(r'gpg\..*').get('format', 'gpg')
+            key_algo = 'openssh' if gpg_format == 'ssh' else 'openpgp'
+            logger.info('N: Using %s key %s defined by user.signingkey', key_algo, user_signingkey)
             logger.info('N: Override by setting patatt.signingkey')
-            config['signingkey'] = 'openpgp:%s' % usercfg.get('signingkey')
+            config['signingkey'] = '%s:%s' % (key_algo, user_signingkey)
         else:
             logger.critical('E: patatt.signingkey is not set')
             logger.critical('E: Perhaps you need to run genkey first?')

base-commit: d8ea60b65cad9b92003eef92153457736652e2bd

Signature · 1 line
2.52.0
#1 lore raw
Quoted 1 line · Bingwu Zhang

Support SSH user.signingkey

Applied, thanks!

[1/1] Support SSH user.signingkey

      commit: cff270b5476ff891cf884eabe8cc18e89c9822a5

Best regards,

Signature · 1 line
KR