I have just installed Git For Windows, and created my SSH key using SSH through Cygwin. It seems to be working from command-line and the Git For Windows GUI, but now I want to use TortoiseGit. TortoiseGit uses a Putty-like SSH client by default but apparently GitHub only accepts (open)SSH, and I don't really know how to proceed. I will be doing a clean TortoiseGit install, I already have Cygwin and Git for Windows installed.
问题:
回答1:
For anyone looking to change an existing TortoiseGit installation to use PuTTY rather than OpenSSH, simply right-click, -> TortoiseGit -> Settings -> Network, then change 'ssh.exe' to 'tortoiseplink.exe'. From then on, doing a push/pull should be using Pageant (and any keys you have set up in there) if you also have that running.
回答2:
The easiest way would be first installing TortoiseGit then msysgit with the setting SSH client to TortoisePLink. Use the TortoiseGit Puttykey generator to create a new keypair add your public key to GitHub.
Clone/create a new repository. In thee Tortoise repository settings, set your fullname and email. Then in remote menu under the Git configuration menu enter your clone URL and select your PuTTY key. GitHub works just fine with PuTTY keys. I have friends that use it, and I used it myself too.
回答3:
1) Cygwin
Use the approach described in the article Working with SSH key passphrases.
A password will be asked for only once on the Cygwin session startup. !!! Before exiting the Cygwin session don't forget to kill the ssh-agent process (use ps for find process PID and kill -9).
We are using a separate approach for Cygwin, because Cygwin by some reason doesn't see processes started externally in a Windows environment.
2, 3) MsysGit, TortoiseGit
Useful link: http://dogbiscuit.org/mdub/weblog/Tech/WindowsSshAgent
Install MsysGit. Install TortoiseGit (check openssh instead of plink during installation). !!! Check systems variables. If there is GIT_SSH variable present - remove it.
Go to TortoiseGit -> Settings -> General.
Set the Git EXE path to <MsysGitHome>/bin. Set the external DLL path to <MsysGitHome>/mingw/bin.
Go to TortoiseGit -> Settings -> Network. Set the SSH Client property to <MsysGitHome>/bin/ssh.exe
Define system variable SSH_AUTH_SOCKS=C:\temp.ssh-socket
Start cmd.exe and execute following commands (since we installed MsysGit all following commands are accessible in cmd - <MsysGit>/bin is added to system PATH variable):
# The following command is required to execute for avoiding an address already bind message when ssh-agen is not started yet but .ssh-socket exists after previous agent session
rm "%SSH_AUTH_SOCK%"
# Starting ssh-agent
ssh-agent -a "%SSH_AUTH_SOCK%"
# Adding our openssh key
ssh-add "%USERPROFILE%\.ssh\id_rsa"
# Type password for your key
That's it. From that moment you can execute git push
, git pull
from TortoiseGit and MsysGit without a prompting passphrase.
When ssh-agent is no longer required you can kill it through Windows Task Manager.