Trying to create private repo using `curl`:
curl -X POST -H "Authorization: Bearer $TEST_TOKEN" https://api.bitbucket.org/2.0/repositories/nosuchip/__abcde -d '{"scm": "git", "is_private": "true", "private": "true, "public": "false", "is_public": "false" }'
As you see I tried a lot of different keys that COULD specify that repo should be private (Bitbucket API documentation is very confusing and misleading). It doesn't works.
I tried also specify these params one by one. Also I rplaced stringified versions `true` and `false` with boolean - nothing works.
Also I tried to create repo and then call PUT request to make it private - PUT constantly returns "you already have such repository for this owner". Documentation for PUT is missing.
Not sure if after few years this is still an issue. I did not find any clear doc, so here you go.
curl --location --request PUT 'https://api.bitbucket.org/2.0/repositories/<WORKSPACE_NAME>/<REPO_NAME>?access_token=<ACCESS_TOKEN>' \
--header 'Authorization: Basic <CLIENT_LOGIN_CREDENTIAL>' \
--header 'Content-Type: application/json' \
--data-raw '{
"is_private": false
}'
The above works.
WORKSPACE - is your workspace name
REPO_NAME - is your repository name
ACCESS_TOKEN - is generated by you to access Bitbucket via API. How to do that can be found here and here
CLIENT_LOGIN_CREDENTIAL - is generated by you to access Bitbucket via API. How to do that can be found here
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.