Skip to content

Instantly share code, notes, and snippets.

@uolot
Created September 14, 2013 23:15
Show Gist options
  • Save uolot/6566557 to your computer and use it in GitHub Desktop.
Save uolot/6566557 to your computer and use it in GitHub Desktop.
Add SSH key to Bitbucket account from shell
curl --user <USER>:<PASSWORD> -X POST https://bitbucket.org/api/1.0/users/<USER>/ssh-keys --data-urlencode "key=<PUBLIC_KEY>" --data-urlencode "label=<LABEL>"
@mudivili
Copy link

mudivili commented Nov 9, 2017

@josa42, facing same issue. Could you tell how you managed to update ssh keys programatically?

Copy link

ghost commented Feb 23, 2018

any update on this?

@nuriyevn
Copy link

nuriyevn commented May 8, 2018

curl -u "<USERNAME>:<PASSWORD>" https://bitbucket.org/api/1.0/users/<USERNAME>/ssh-keys --data-urlencode "key=$(cat /root/.ssh/root.pub)" -data-urlencode "label=my_key"

This will add global keys regardless to repository (if you want write access to your all repositories), bitbucket also provide another option READ permission repository basis (useless unless you want to pull, not push). Unfortunately, there is no option to make WRITE permission for certain repo (correct me, guys if I am mistaken)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment