08.generate_ssh_key.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. echo "In a web browser, create or access your personal Github account (Optional):"
  7. echo " 1) In a new tab, open https://github.com in a web browser."
  8. echo " 2) Access with your personal Github credentials or create a new one."
  9. echo " 3) Access to https://github.com/settings/keys and leave it open"
  10. echo ""
  11. echo -e "\033[33;5m Don't close Github page when finished... \033[0m"
  12. echo ""
  13. read -rp "Press enter when finish to create ssh keys..."
  14. echo "Generating ssh key in $HOME/.ssh/id_rsa.pub file..."
  15. cat /dev/zero | ssh-keygen -q -t rsa -N ""
  16. echo "Generating ssh key in $HOME/.ssh/id_rsa.pub file... DONE"
  17. #echo "Copying content of '~/.ssh/id_rsa.pub' file to the clipboard..."
  18. #xclip -sel c <~/.ssh/id_rsa.pub
  19. #echo "Copying content of '~/.ssh/id_rsa.pub' file to the clipboard... DONE"
  20. #echo ""
  21. #echo -e "\033[33;5m If you copy other thing to the clipboard, here is your ssh public key, ready to copy again... \033[0m"
  22. #echo ""
  23. cat ~/.ssh/id_rsa.pub
  24. echo ""
  25. echo "Add SSH keys to Github account (Optional):"
  26. echo " 1) Access ssh-keys settings in https://github.com/settings/keys"
  27. echo " 2) Paste the key copied from ~/.ssh/id_rsa.pub and press 'Add key' button."
  28. echo ""
  29. read -rp "Press enter when finish to continue..."