KEY="$HOME/.ssh/deploy_key"
# Generate only if it doesn't exist
if [[ ! -f "$KEY" ]]; then
ssh-keygen -t ed25519 -f "$KEY" -N "" -C "deploy@$(hostname)"
fi
# Show the public key (for pasting into GitHub deploy keys, etc.)
cat "$KEY.pub"
# Get the fingerprint
ssh-keygen -lf "$KEY.pub"
# 256 SHA256:abc... deploy@host (ED25519)
# Add to ssh-agent (so you don't have to specify -i every time)
eval "$(ssh-agent -s)"
ssh-add "$KEY"
# Configure git to use this specific key for one host
cat >> ~/.ssh/config <<EOF
Host github-deploy
HostName github.com
User git
IdentityFile $KEY
IdentitiesOnly yes
EOF
Create a free account and build your private vault. Share publicly whenever you want.