Tuesday, September 18, 2012
Accessing Git Repositories using SSH behind HTTP proxy (Corkscrew, OpenSSH)
OpenShift uses SSH for its Git repositories. But at my workplace, where I need to use a HTTP proxy to access the Internet, getting TortoiseGit to connect to the Git repository seemed impossible. Out of the box, SSH can't be accessed via HTTP proxies. After vigorous searching using Google, I came across Corkscrew (http://www.agroman.net/corkscrew/README). Corkscrew enables tunnelling of TCP connections through HTTP/S proxy servers.
Since I am using Windows, and happen to use Cygwin (was required by OpenShift) and TortoiseGit, here's what I did to make it work:
1. Fire up Cygwin setup, searched for 'corkscrew', download packages
2. In my Cygwin home folder (default folder for SSH settings), open file ~\.ssh\config
3. Add/modify the ProxyCommand line (replace with your proxy IP and port) as shown in the example below:
Host *.rhcloud.com
IdentityFile ~/.ssh/libra_id_rsa
VerifyHostKeyDNS yes
StrictHostKeyChecking no
UserKnownHostsFile ~/.ssh/libra_known_hosts
ProxyCommand /bin/corkscrew localhost 8118 %h %p
4. Open TortoiseGit's Settings window, go to Network. Check the 'Enable Proxy Server' option, and add the proxy IP and port values.
5. In the SSH client textbox, enter the path to the ssh.exe file e.g. C:\cygwin\bin\ssh.exe. This assumes that you are using OpenSSH in Cygwin. Click OK.
That's it, now you can access your Git repository via SSH behind a HTTP proxy!
Labels:
git
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment