Issue: can't use ssh or git commands when connected on VPN. This is because, for now, outgoing ssh / TCP 22 is blocked.
We have to tunnel through the web proxy. Here is how:
- Download and install
nmap-7.70-setup.exe
from https://nmap.org/download.html. We will usencat
tool to send all packets through the proxy. - Open command line (WIN Key+R+
cmd
+ENTER) cd %USERPROFILE%\.ssh
. This is where you have stored your ssh private key for GitHub- Create a new file named
config
- Add
Host github.com
Hostname github.com
port 22
ProxyCommand ncat --proxy <your-http-proxy>:8080 %h %p
identityfile ~/.ssh/github.privatekey.pem
- We will use
nc
to send all packets through the proxy. - Edit
~/.ssh/config
:nano ~/.ssh/config
| - Add
Host github.com
Hostname github.com
port 22
ProxyCommand nc -X connect -x your-http-proxy:8080 %h %p
identityfile ~/.ssh/github.privatekey.pem
- If you use ArchLinux, you can use socat:
ProxyCommand socat - PROXY:web-proxy:%h:%p,proxyport=8080
- Issue
chmod 400 ~/.ssh/config
to set permissions right for this file
📝 Replace "web-proxy" with the proper web proxy which works at your site, and
github.privatekey.pem
with your actual private key file.
You can then use git commands as usual, with git URLs:
git clone git@github.com:your_user/your_repo.git
ProxyCommand
line in your ssh/config
.