I finally resolved the issue with Git commit signing in the WSL environment.

121

It was difficult to sign Git commits in WSL for several reasons.

The reason is that the working folder is in Windows (%USERPROFILE%\Documents), but I usually develop within WSL because bash is more familiar than CMD or PowerShell.

Of course, there's a way to manage projects directly in WSL, but this time the Git function doesn't work properly in Windows IDE.


After going through various trial and error, I finally came up with a script thinking 'Wouldn't it be enough to change the executable binary according to the path when running git and gpg?'

Git works fine, but gpg doesn't work properly as follows:

[code][hm:...ents/Release/upgrade-gitlab]$ gpg --list-secret-keys --keyid-format=long

gpg: error running '/usr/lib/gnupg/keyboxd': probably not installed

gpg: failed to start keyboxd '/usr/lib/gnupg/keyboxd': Configuration error

gpg: can't connect to the keyboxd: Configuration error

gpg: error opening key DB: No Keybox daemon running

gpg: keydb_search_first failed: Input/output error[/code]

???: Hey, this is a Windows path, why are you looking for /usr/lib...


Of course, if you run a command like 'gpg --list-keys' in CMD once, the problem will be solved, but it's not smooth.

So, after talking with Jemina a lot, I decided to download gpg? So I installed GnuPG.Gpg4win using winget.

However, this time Git's gpg and GnuPG were looking at completely different paths.

  • Git: %USERPROFILE%\.gnupg
  • GnuPG: %APPDATA%\gnupg

So, 'Wouldn't it be okay to just replace the directory that Git was using with GnuPG and maintain backward compatibility with mklink /J?' I expected a lot and modified the path...

gpg keyboxd was lost {emo:onion-038.gif:50}{emo:onion-030.gif:50}

In the end, after removing (not revoking) the lost keys from our GitLab, personal GitLab, and GitHub, I removed Windows' GnuPG and decided to use WSL's gpg.


However, the key issue was how to authenticate WSL's gpg key in Windows.

All the keys I use are habitually password-protected. (They're all the same... problem...)

If the password input window doesn't appear as a GUI, password entry is impossible unless you hijack the terminal stdin and stdout.


After a lot of discussion with Jemina, I got the following results:

Finally, both WSL and Windows can successfully display the password input window, and commit signing works normally after successful password entry.

로그인한 회원만 댓글 등록이 가능합니다.

개발한당

KR | ID | EN
  • IDR
  • KOR
7.52 =0.00

2026.10.10 KEB 하나은행 고시회차 4019회

다가오는 한인 행사일정

  • 등록 된 일정이 없어요!