Created
October 19, 2024 19:31
-
-
Save thesuhu/78f1d0529c78f145b067ec35bd40a1e3 to your computer and use it in GitHub Desktop.
Generate an SSH public key using an email parameter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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