I am currently developing code on a remote server by using Visual Studio Code's remote SSH feature to remotely edit code using VSCode that is running on my local machine. Local machine is on Mac OS X Catalina 10.15.5, while the remote server is running Ubuntu 20.02 inside WSL2.
When I try to create a regular commit in VSCode, it works as expected. However, when I try to autosign the commit, the following error appears after clicking on the "commit" button in VSCode:
Git: gpg failed to sign the data
In order to create a signed commit remotely, I had to run the following in the VSCode terminal:
git commit -S -m "my commit msg"
which brings up the full screen UI in the terminal
┌────────────────────────────────────────────────────────────────┐
│ Please enter the passphrase to unlock the OpenPGP secret key: │
│ "Nyxynyx <[email protected]>" │
│ 4096-bit RSA key, ID B22A24D512345678, │
│ created 2001-01-08. │
│ │
│ │
│ Passphrase: ****************__________________________________ │
│ │
│ <OK> <Cancel> │
└────────────────────────────────────────────────────────────────┘
Entering the correct passphrase allowed the commit to be signed.
Question: Is there a way to create a signed commit using only VSCode UI and without using the terminal?
After digging a while, I found two solutions:
Here you have access to your C: drive, and you can edit your ~/.gitconfig and set the gpg.program to the same you use when you are on windows, like this:
The only solution I found besides using the terminal is installing the extension called "vscode-gpg-indicator". Follow the instructions, and you'll get a locker in your status bar, where you can unlock the GPG key before starting the commit.