Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Create repository to an existing project using API 2.0 on Bitbucket Cloud

I am trying to create repositories and add them to specific projects by using:

 curl -X POST -u "${bcUser}:${bcPass}" "${workspace}/${repo_lower}" \
-H "Content-Type: application/json" \
-d '{"is_private": true, "language": "php", "project": {"key": '$project'}}'

But it is not considering the parameters passed. Just checked on the documentation:

And is_private, language and project don't seem to be part of the options specified. I am new on this, and I would like to be able to specify the privacy as well as moving the created repository to an existing project.

After creating the repository, I tried moving the repository to the existing project with the following command, but did not work either:

curl -X PUT -u "${bcUser}:${bcPass}" "${owner}/projects/${project}" \
-d '{"repositories": "${owner}/'${repo_lower}'"}'


I am working on Bitbucket Cloud. Thanks in advance

1 answer

1 accepted

0 votes
Answer accepted

I'm answering myself in case somebody needs it ( I assume the URL needs to be the last one...):

curl -X POST -u "${bcUser}:${bcPass}" \
-H "Content-Type: application/json" \
-d '{ "scm": "git", "is_private": true, "project": {"key": "'${project}'"}}' \ "${owner}/${repo_lower}"

Thank you so much!

Works great after removing simple quotes in "'${project}'" => "${project}"

Like Laura Pons likes this

Hi Laura Pons

im having problem with this ...

can i use token in this curl command  ?



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,238 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you