How to Git to GitHub via proxy

This how-to post is specific for Linux system and for connecting to GitHub through its SSH address only. Basically it goes like this:
-first you need to install Corkscrew program from your Linux repo (or compile it from source if it isn’t available in repo). You’ll need this tool for tunneling SSH through HTTP proxies.
-from there you tell Corkscrew about your proxy credentials (username & password for your proxy server)
-then you generate your SSH keys and add the public key to your GitHub account. The SSH keys needed to identify your computer as trusted.
-make a simple bash script to execute corkscrew program to connect to GitHub SSH address.
-after that you need to set Git proxy setting in your computer to refer to that simple bash script you just created.
Some details below:

installing/compiling corkscrew.
I leave this one for you to figure out since its vary from one Linux distro to another.
put your proxy authentification setting in ~/.corkscrew-auth
In this step you put your username and password for your proxy server in ~/.corkscrew-auth with the following format
username:password
For example: ferry_th@ferryth.org:secret

generating SSH keys stuff
Follow instruction in generating SSH keys in Github tutorial on how to do it.

make a bash script to execute corkscrew program to connect to Github SSH address.
Create a bash script and put the following code into it. Make sure you change the bold text to reflect your proxy setting. Then save the script to somewhere in your computer. Don’t forget to mark that script file as executable.

#!/bin/sh
exec /usr/local/bin/corkscrew your_proxy_address your_proxy_port ssh.github.com 443 ~/.corkscrew-auth

-setup Git proxy setting to refer to that simple bash script you just created
Edit ~/.gitconfig file and add the following code. Make sure you change the bold text to refer to the bash script you just created.

[core]
gitproxy = /home/ferry/git-proxy.sh

Testing out…

me gitting to Github

me gitting to Github

Advertisements

Tags: ,

About Ferry T.H.

I'm just your fellow human being.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: