Bas Grolleman’s Blog

Place where I put my written thoughts, though I usually just make video’s these days

Sometimes life doesn’t work out, you want to be able to push/pull your code to github but the machine you are working on doesn’t have internet access to do so and in my case  the receiving github server is internal so even with internet it would not have worked.

How to fix this with a reverse tunnel, add the following to your local ~/.ssh/config

Host example-host
  RemoteForward 12222 github.com:22

And on example-host, add this to the ~/.ssh/config

Host github.com
  hostname localhost
  port 12222

Now, I’m assuming you already have a straight line to the host you are working on, if not using ProxyCommand might solve that. And that you have AgentForwarding enabled because unprotected ssh keys are bad m’kay.

Now,  once this is setup, you ssh to the host and should be able to use it without voodoo on the prompt

git clone git@github.com:username/project

Enjoy.