git clone ssh behind proxy windows

Git protocal

1
2
3
git://
https://
ssh://

Create repository

git init --bare

Clone repository

git clone user@remote-server:/home/git/repo.git

Clone repository behind a firewall proxy

  • Edit ~/.ssh/config, add following command to it
    1
    2
    ProxyCommand C:/connect-1.104-win32-msvc/connect.exe -H proxyserver:8080 %h %p
    IdentityFile "C:/Users/user/Desktop/id_rsa"
  • Open cygwin, run git clone command above to retrieve repository.

Clone repository by git protocal

  • Install socat, then create a file named gitproxy, its content as below,
    $ sudo vi /usr/bin/gitproxy

    1
    2
    3
    4
    5
    6
    #!/bin/bash

    PROXY=squid.vpsee.com
    PROXYPORT=3128
    PROXYAUTH=username:password
    exec socat STDIO PROXY:$PROXY:$1:$2,proxyport=$PROXYPORT,proxyauth=$PROXYAUTH

    $ git config --global core.gitproxy gitproxy

  • Clone repository
    git clone git://user@remote-server:/home/git/repo.git

http://cms-sw.github.io/tutorial-proxy.html
http://www.vpsee.com/2011/07/how-to-use-git-through-a-http-proxy/
http://www.laurii.info/2013/04/git-ssh-behind-proxy-windows/
http://stackoverflow.com/questions/3248779/which-is-faster-ssh-or-git-protocol