Home > Blockchain >  Can I make SSH ForwardAgent and ProxyJump work with Git?
Can I make SSH ForwardAgent and ProxyJump work with Git?

Time:10-16

I have two computers; my workstation and a laptop I use to run my company VPN. I need to go through the VPN in order to reach my Git remote (BitBucket).

I have an SSH agent running on my workstation that contains the SSH key needed to connect to the Git remote. I have configured SSH to forward my SSH agent when connecting to my laptop:

Host my-laptop
    ForwardAgent yes

If I use SSH to connect to my laptop, I can successfully git pull, and ssh-agent -l confirms that the SSH agent was properly forwarded. So far so good!

Here's the challenge: I want to use git directly from my workstation. This should be possibly by configuring SSH to proxy through my laptop. My git remotes look like this:

➜ git remote -v
origin  ssh://[email protected]:7999/my-team/my-project.git (fetch)
origin  ssh://[email protected]:7999/my-team/my-project.git (push)

So I added this SSH configuration:

Host *.my-company.com
    ProxyJump my-laptop

The proxy jump worked, because now I reach the Git remote!

  • Related