Skip to content

Instantly share code, notes, and snippets.

@vadimkantorov
Last active April 22, 2025 19:55
Show Gist options
  • Save vadimkantorov/fe75f9ff51ea2de360bb4498fb1581e3 to your computer and use it in GitHub Desktop.
Save vadimkantorov/fe75f9ff51ea2de360bb4498fb1581e3 to your computer and use it in GitHub Desktop.
Various ssh commands
# https://superuser.com/questions/1687960/over-ssh-can-you-use-the-same-private-key-on-the-host-side-for-other-purposes
alias sshagentssh='ssh-agent ssh -A -o AddKeysToAgent=yes'
# generate ssh key for github
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
ssh-keygen -t ed25519 -b 4096 -C "[email protected]" -f ./id_ed25519 -N="" # -q
# https://stackoverflow.com/questions/4565700/how-to-specify-the-private-ssh-key-to-use-when-executing-shell-command-on-git
# https://github.com/settings/ssh/new
export GIT_SSH_COMMAND="ssh -o IdentitiesOnly=yes -i $PWD/id_ed25519"
eval $(ssh-agent) # on local machine, will print ssh agent's PID
env | grep '^SSH_AUTH_SOCK=' # check
env | grep SSH_AGENT_PID # check PID
kill -9 $(SSH_AGENT_PID)
# ssh -A ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment