Last active
March 27, 2019 01:39
-
-
Save peacefixation/8297a2e8c87b6df719163095db04578d to your computer and use it in GitHub Desktop.
Forward SSH agent to remote host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.ssh.com/ssh/agent | |
# https://developer.github.com/v3/guides/using-ssh-agent-forwarding/#setting-up-ssh-agent-forwarding | |
# on the remote host | |
# /etc/ssh/sshd_config must have 'AllowAgentForwarding yes' | |
# on your local machine | |
# /etc/ssh/ssh_config must have 'ForwardAgent yes' | |
cat >> ~/.ssh/config <<EOF | |
Host host.example.com | |
ForwardAgent yes | |
EOF | |
ssh-add ~/.ssh/id_rsa | |
ssh -A user@remote-host | |
# clone a repo from a server that has your SSH keys that are now forwarded to the remote host | |
git clone ssh://git@scm-host:7999/project/repo.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment