Skip to content

Instantly share code, notes, and snippets.

@borestad
Last active August 29, 2015 14:21
Show Gist options
  • Save borestad/2e8a1de44e6217f2bc12 to your computer and use it in GitHub Desktop.
Save borestad/2e8a1de44e6217f2bc12 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: bash <(curl -sL http://bit.ly/1KhQDUU)
# https://confluence.atlassian.com/display/BITBUCKET/ssh-keys+Resource
echo "\n"
printf "Bitbucket account name: "
read account
printf "Bitbucket user: "
read username
printf "Password:"
read -s password
echo
echo "Generationg ssh-key, adding it to ~/.id_rsa.pub"
ssh-keygen -t dsa -N "" -C "$username" -f ~/.ssh/id_rsa
ssh_key=`cat ~/.ssh/id_rsa.pub`
printf "Add a label to your bitbucket ssh-key: "
read ssh_label
echo "Adding your ssh-key to Bitbucket ..."
echo
curl -u $username:$password --data-urlencode "key=$ssh_key" --data-urlencode "label=$ssh_label" https://bitbucket.org/api/1.0/users/${account}/ssh-keys
echo "\n\n"
echo "Cloning into dotfiles ... "
git clone [email protected]:$account/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
./script/bootstrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment