Skip to content

Instantly share code, notes, and snippets.

@thesuhu
Created October 19, 2024 19:31
Show Gist options
  • Save thesuhu/78f1d0529c78f145b067ec35bd40a1e3 to your computer and use it in GitHub Desktop.
Save thesuhu/78f1d0529c78f145b067ec35bd40a1e3 to your computer and use it in GitHub Desktop.
Generate an SSH public key using an email parameter.
#!/bin/bash
# Check if email is provided as an argument
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [email]"
exit 1
fi
EMAIL=$1
KEY_NAME="$HOME/.ssh/id_ed25519"
# Generate SSH key
ssh-keygen -t ed25519 -C "$EMAIL" -f "$KEY_NAME" -N ""
# Display the public key
cat "${KEY_NAME}.pub"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment