Skip to content

Instantly share code, notes, and snippets.

@alphamarket
Last active September 27, 2024 18:58
Show Gist options
  • Save alphamarket/e0ed48f8755bebdc7451b758bc6828fa to your computer and use it in GitHub Desktop.
Save alphamarket/e0ed48f8755bebdc7451b758bc6828fa to your computer and use it in GitHub Desktop.
Creating SSH proxy and making Git connect through it
# [step 1] create a ssh-proxy
ssh -D 9999 -qCN [email protected]
# [step 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"' [email protected]:user/repo.git
# OR [current repository use only]
git config core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:9999 %h %p"'
@alphamarket
Copy link
Author

To install connect on Ubuntu:

sudo apt install connect-proxy

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