Created
July 31, 2017 07:21
-
-
Save watzon/f87a7fd4bf931653264d67151dec06a5 to your computer and use it in GitHub Desktop.
SSH Key Generation for .zshrc
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
function gen_ssh_key { | |
# Generate an ssh key | |
filename=${2:-"~/.ssh/id_rsa"} | |
ssh-keygen -f $filename -t rsa -b 4096 -C "$1" -N "" | |
if hash xclip 2>/dev/null; then | |
cat $2.pub | xclip -selection clipboard | |
elif hash pbcopy 2>/dev/null; then | |
cat $2.pub | pbcopy | |
else | |
cat $2.pub | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment