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:
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
For example: email@example.com: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.
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.
gitproxy = /home/ferry/git-proxy.sh