I am having trouble configuring Visual Studio 2022 to sign Git commits for GitHub using SSH or GPG keys.
I tried setting up GPG signing using the following commands:
git config --global user.signingkey 3AA5C34371567BD2
git config --global commit.gpgsign true
However, when I try to make a commit in Visual Studio.
I get the following error:
Your Git hook is not supported. This is probably because the first line is not "#!/bin/sh".
I checked all the files in the .git/hooks directory and they all have #!/bin/sh as the first line.
If I don’t set git config --global commit.gpgsign true, the commit goes through but on GitHub it is marked as unverified.
How can I properly configure Visual Studio to sign Git commits for GitHub using SSH or GPG keys? Any help would be greatly appreciated.
Update:
I found a solution for signing commits with SSH in Visual Studio 2022. Here are the steps I followed:
- Edit the gitConfig file using the command
git config --global --edit. - Add the following line:
[gpg "ssh"] sshCommand = C:/Windows/System32/OpenSSH/ssh.exe. - Run the following commands:
git config --global gpg.format ssh,
git config --global user.signingkey /C:/Users/Admin/.ssh/id_signinged25519.puband
git config --global commit.gpgsign true.
Now, when I do a PUSH with Visual Studio, the commits have the verified label in GitHub.