Created
January 5, 2021 03:44
-
-
Save maivdigital/5df29242946108f263aaf3a153f69ec8 to your computer and use it in GitHub Desktop.
Generate SSH key bash
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 | |
echo -e "====== Starting SSH Agent =======\n\n"; | |
eval "$(ssh-agent)"; | |
echo -e "====== Continue with the default, just hit enter =========\n\n"; | |
ssh-keygen -t rsa -b 4096 | |
echo -e "======= Generating SSH Key is done and saved at ~/.ssh/id_rsa ==========\n\n"; | |
cat ~/.ssh/id_rsa.pub | |
echo -e "\n"; | |
echo -e "====== Copy the content of public key and paste into your Repo ============\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#!/bin/bash
#Updated version
#Run SSH Agent once
runcount=$(ps -ef | grep "ssh-agent" | grep -v "grep" | wc -l)
if [ $runcount -eq 0 ]; then
echo -e "====== Starting SSH Agent =======\n\n";
eval "$(ssh-agent)";
echo -e "====== Continue with the default, just hit enter =========\n\n";
ssh-keygen -t rsa -b 4096
echo -e "======= Generating SSH Key is done and saved at ~/.ssh/id_rsa ==========\n\n";
cat ~/.ssh/id_rsa.pub
echo -e "\n";
echo -e "====== Copy the content of public key and paste into your Repo ============\n\n"
fi