Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. SSH provides encrypted remote access.
ls ~/.ssh
This command creates both a private and a public key as a pair. Keep the private key secret, and share the public key.
ssh-keygen -t ed25519 -C "your-email@example.com"
# This creates two keys:
# - id_ed25519 (private)
# - id_ed25519.pub (public)
This command tells your system to load a private SSH key into the SSH authentication agent. This makes the key available for SSH connections, and lets you authenticate without retyping the passphrase every time.
ssh-add ~/.ssh/id_ed25519_fc
You can copy the public key somewhere like GitHub to enable remote access.
cat ~/.ssh/id_ed25519.pub
nano ~/.ssh/config
ssh -T git@github.com
# Hi username! You've successfully authenticated, but GitHub does not provide shell access.
# Use one SSH key
ssh -i ~/.ssh/id_rsa -T git@github.com
# Use another SSH key
ssh -i ~/.ssh/id_ed25519 -T git@github.com
These commands let you run commands using specific keys.
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519" \
git clone git@github.com:Organization/Project.git
GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519" \
git push -u origin feat/add_static_outage_page