update ssh generation script

This commit is contained in:
Georgi Gardev
2024-03-07 11:13:58 +02:00
parent 096ffe0f7d
commit d5694f106e
+5 -3
View File
@@ -2,17 +2,19 @@
echo "Generating a new SSH key..."
read -p "Enter your email: " SSH_EMAIL
if [ ! -f ~/.ssh/id_ed25519 ]; then
echo "~/.ssh/id_ed25519 does not exist, generating a new SSH key...";
ssh-keygen -t ed25519 -C $1 -f ~/.ssh/id_ed25519
ssh-keygen -t ed25519 -C $SSH_EMAIL -f ~/.ssh/id_ed25519
eval "$(ssh-agent -s)"
ssh-add -K ~/.ssh/id_ed25519
touch ~/.ssh/config
echo -e "\nHost github.com\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/id_ed25519" | tee -a ~/.ssh/config
else
echo "SSH key already exists, skipping generation..."
fi;
echo "run 'pbcopy < ~/.ssh/id_ed25519.pub' to get the public key"