Sunday, November 16, 2008

Why I love GIT and GITHUB..:) I can push my changes to public repo, sitting behind one of those corporate network, which allows only http/https through them...

On GITHUB we can host our repos and access from anywhere..( from behind corporate firewalls, proxy...)

There are many links out there over internet, which helps us how to do that...but the basic thing what I was doing wrong was trying to push on ssh's default port 22 and to server, rather than

Finally reading this end, I was successful in git-push!. Here is how we can do that....

Variables to be set before proceeding.

++ For those who are lucky ( got root / sudo access ) ++

1. Install corkscrew...( apt-get upgrade corkscrew)
2. edit ~/.ssh/config

ProxyCommand corkscrew 8080 %h %p ~/.ssh/proxyauth
Port 443
ServerAliveInterval 10
IdentityFile /home/dilipm/.ssh/github

- is the IP of found from nslookup
- File ~/.ssh/proxyauth contains your username and passwd of proxy server. in format username:passwd

- 443, this is where I was doing wrong! I was trying port 22.
- /home/dilipm/.ssh/github, path of my private key

3. set env variable GIT_PROXY_COMMAND=/home/dilipm/.ssh/proxy_cmd_for_github.
where cat /home/dilipm/.ssh/proxy_cmd_for_github is,
corkscrew 8080 443 ~/.ssh/proxyauth

That's just do ssh -v git@
At the first attempt the server's ( fingerprint will be added to local know_hosts file.

++ For those who are unlucky ( don't have root access ) ++

1. download the perl script of Mark suter..

2. change the proxy details as required...

3. change the ProxyCommand in ~/.ssh/config as below,
ProxyCommand ~/ %h %p

that's it....try doing ssh -v git@


perfectionlabs said...

Hi! Thanks for the tutorial. I would suggest putting association between and inside the /etc/hosts to keep the it in one, standard place.

Also what about the project origin? Did you have to change it to <...> instead of standard <...>? I had to and since then it works fine for me.

Jakub Pawlowicz

lgs said...

I've tried but fails :

[~]# ssh -v
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /home/user/.ssh/config
debug1: Applying options for
debug1: Executing proxy command: exec ~/ 443
debug1: identity file /home/user/.ssh/identity type -1
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: identity file /home/user/.ssh/id_dsa type -1
/home/user/ CONNECT failed: SSH-2.0-
ssh_exchange_identification: Connection closed by remote host

[~]# cat ~/.ssh/config
ProxyCommand ~/ %h %p
Port 443
ServerAliveInterval 10

Any suggestion will be greatly appreciated

The Grey Lens Man said...

Seems more then is truly necessary.

1) Create a github alias in your .ssh/config to use ssh on port 443
cat .ssh/config
Host github
User git
Port 443

2) Modify your .git/config file to use said alias
cat /myproject/.git/config
[remote "origin"]
url = git@github:MyProj/cdap2.git

Tim Cuthbertson said...

thanks grey lens man. Much simpler.

I still needed the ProxyCommand line for mine, and I used "Host:" because that way I don't have to use anything unusual in my git remote.

To the original author: Why are you using a hard-coded IP?

Venkatesh said...

thanks grey lens man, your idea worked for me on Windows 7, i am now able to connect to thru 443.

Indiana said...

You have a very good blog that the main thing a lot of interesting and useful!

dilipm79 said...

ah! never got time to catch up. I wish to work full time on GIT. I'm available for hire :)