31

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.

Mr. Boy
  • 52,885
  • 84
  • 282
  • 517

4 Answers4

39

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.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
zcrar70
  • 2,996
  • 2
  • 21
  • 18
9

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.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Learath2
  • 15,755
  • 2
  • 18
  • 30
  • Is it possible to change msysgit to use TortoisePLink after installation? If so how - then I could just create a new putty key. – Mr. Boy Apr 19 '12 at 12:46
  • You can do `cd ~ ; echo "GIT_SSH = "c:/path/to/tortoiseplink.exe"" > .profile` it should work but a clean reinstall and openssh without tortoise git or plink with tortoise git is better – Learath2 Apr 19 '12 at 13:09
  • I removed the apps to do a clean install - but when I installed Git for Windows (msysgit) this time, I don't get the step where it asks about the SSH executable. Some setting left behind maybe, I checked the main git dir was removed :( – Mr. Boy Apr 20 '12 at 13:13
  • Check either the environment variable or trr the other solution i provideds. – Learath2 Apr 20 '12 at 13:20
  • The ssh values may be left in `C:\Documents and Settings\\.ssh\` - It's where mine ended up, and are separate from the Git for Windows (un)install. – Philip Oakley Apr 22 '12 at 22:16
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.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
ydrozhdzhal
  • 134
  • 1
  • 4
0

refer to the solution given here https://community.atlassian.com/t5/Sourcetree-questions/SourceTree-to-GitHub-Enterprise/qaq-p/1073288#M38541 by Anmol Jain which works perfectly fine. He has posted solution for source tree which works for tortoise git also.

easy way to clone and do etc things is as below

  1. from github enterprise just copy the https link to clone
  2. in the local machine in tortoise git --> git clone --> in the URL make as below http://@git.example.com/BTS/fp-pro-license.git/ORG1/spring-project.git so you will be able to clone