Skip to content

Instantly share code, notes, and snippets.

@alphashuro
Created April 9, 2022 14:28
Show Gist options
  • Save alphashuro/62af281d9562f25e604fe595e21c062b to your computer and use it in GitHub Desktop.
Save alphashuro/62af281d9562f25e604fe595e21c062b to your computer and use it in GitHub Desktop.
#!/bin/sh
read -e -p "1password email?: " onepassemail
read -e -p "1password domain?: " onepassdomain
op account add --address $onepassdomain --email $onepassemail
eval $(op signin --account $onepassdomain)
# TODO: handle existing private key
mkdir -p $HOME/.ssh
KEY=$HOME/.ssh/id_rsa
touch $KEY
chmod 600 $KEY
echo "{{ index (onepasswordDetailsFields "SSH Key") "private key" "value" }}" >> $KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment