Skip to content

Instantly share code, notes, and snippets.

@watzon
Created July 31, 2017 07:21
Show Gist options
  • Save watzon/f87a7fd4bf931653264d67151dec06a5 to your computer and use it in GitHub Desktop.
Save watzon/f87a7fd4bf931653264d67151dec06a5 to your computer and use it in GitHub Desktop.
SSH Key Generation for .zshrc
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