Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can I create a bitbucket repository using REST API?

Jesus October 8, 2012

Hi,

I would like to know whether it is possible to create a bitbucket repository using the REST API. If so, can you please post the curl command I have to use? Thanks!

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

6 votes
Answer accepted
Jesus October 8, 2012

I managed to do by myself, thanks!

curl -k -X POST --user user:pass "https://api.bitbucket.org/1.0/repositories" -d "name=project_name"

0 votes
bahadır kocamusaoğlu March 5, 2015

after create repo how can add user to thıs repo ...?

Rahul Sahotay April 26, 2017

If anyone still looking for the answer, Please use following REST query

curl -s -u user:passwd -k --header "Content-Type: application/json" -X PUT "https://bitbucket.**.com/rest/api/1.0/projects/{project-KEY}/repos/{REPO NAME}/permissions/groups?permission=REPO_WRITE&name={GROUP NAME}"

Available repository permissions are:
REPO_READ
REPO_WRITE
REPO_ADMIN

Ruthirakumaran Singaravelou November 22, 2018

Still it didnt worked out for my case:

My requirement : Project already manually created( SGIN), but i need to create repo only using curl and my repo name should be orange

curl -X POST -v -u username:password -H "Content-Type: application/json" \
  https://api.bitbucket.org/2.0/repositories \
  -d '{"scm": "git", "is_private": "false","project": {"key": "SGIN"}, "name":"orange" }'

but my https:// is differ and how would it will create under my projects?

my https://bitbucket-apac12.aws.es.com/scm/sgin/

Can anyone help me out ?

TAGS
AUG Leaders

Atlassian Community Events