Skip to content

Instantly share code, notes, and snippets.

@sayef
Created March 30, 2022 20:27
Show Gist options
  • Select an option

  • Save sayef/bf3f1f1823435269635346ea980fda17 to your computer and use it in GitHub Desktop.

Select an option

Save sayef/bf3f1f1823435269635346ea980fda17 to your computer and use it in GitHub Desktop.
How to use git ssh command using ssh-proxy
  1. create a ssh-proxy ssh -D 9999 -qCN user@server.net

  2. make git connect through the ssh-proxy

  • [current script only] export GIT_SSH_COMMAND='ssh -o ProxyCommand="connect -S 127.0.0.1:9999 %h %p"'
  • OR [git global setting] git config --global core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:9999 %h %p"'
  • OR [one-time only use] git clone -c=core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:9999 %h %p"' git@github.com:user/repo.git
  • OR [current repository use only] git config core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:9999 %h %p"'

Source: https://stackoverflow.com/a/58253407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment