# Created on savesnippets.com ยท https://savesnippets.com/Rl68WCp6JHyXAx 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 <