sourcegit-scm / sourcegit

Windows/macOS/Linux GUI client for GIT users
MIT License
664 stars 69 forks source link

[Feature] (for Windows) Add PuTTY / Plink support as an optional method for SSH agent #242

Open LiarOnce opened 2 weeks ago

LiarOnce commented 2 weeks ago

OpenSSH's ssh-agent may have difficult to troubleshoot functional issues in Windows, and PuTTY can be used as an alternative solution for SSH agents.

love-linger commented 2 weeks ago

I have not used PuTTY before, can you explain the differences between it and OpenSSH in use?

LiarOnce commented 2 weeks ago

On Windows, PuTTY uses Pageant as the key manager and Plink for connectivity. Instead of using system services like OpenSSH, you can just run Pageant in the background.

All components of PuTTY are portable apps.

image (When using PuTTY as an SSH client in SourceTree)

love-linger commented 2 weeks ago

I'm using the following command to specify the private key for a remote:

git -c core.sshCommand="ssh -i '${sshKey}' fetch/pull/push"

What is its equivalent in PuTTY?

Another question, when enable commit GPG signing with SSH method, what do I need to be aware of as opposed to OpenSSH?

image

LiarOnce commented 2 weeks ago

I'm not sure how to use Plink for individual repositories, but generally it's used in the form of a global setting:

git config --global core.sshCommand 'plink -ssh'

And it uses this command to use the private key:

plink -ssh -i <putty_key_file>.ppk

The .ppk file here is the PuTTY Private Key format, and it can also be exported as a private key in OpenSSH format.

Regarding GPG, there is no need to pay attention to anything because neither PuTTY nor OpenSSH affects the GPG signing.

love-linger commented 2 weeks ago

I'm not sure how to use Plink for individual repositories, but generally it's used in the form of a global setting:

git config --global core.sshCommand 'plink -ssh'

And it uses this command to use the private key:

plink -ssh -i <putty_key_file>.ppk

The .ppk file here is the PuTTY Private Key format, and it can also be exported as a private key in OpenSSH format.

Regarding GPG, there is no need to pay attention to anything because neither PuTTY nor OpenSSH affects the GPG signing.

Thanks very much. Let me think about how to achieve this feature later