It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Create and configure a Bitbucket Server repository using the REST API endpoints

How to create a repository using the REST API endpoints?

To create a new repository, we will be using the following endpoint:

POST /rest/api/1.0/projects/{projectKey}/repos

 

When using curl, the full command looks like this:

curl --user <user>:<password> -H "Content-Type: application/json" --data @input.json -X POST <Bitbucket URL>/rest/api/1.0/projects/<projectKey>/repos

 

(i) The authenticated user must have PROJECT_ADMIN permission for the parent project to be able to create a repository.

 

There are various options that can be set while creating the repository depending on the content of the input.json file.

 

Straightforward creation

At a minimum, the input file has to contain the name of the repository:

{
"name": "My Repository"
}

 

Publicly accessible repository

To enable the "Public access" while creating the repository, this is how to define the payload:

{
"name": "My Repository",
"public": true
}

Non forkable repository

A non forkable repository ("Allow forks" option unchecked) is created by using this input file:

{
"name": "My Repository",
"forkable": false
}

 

Reference documentation

1 comment

Is there a full list of repository settings somewhere?

I am trying to change "pull requests"->"Unapprove automatically on new changes" to true, but have no idea where to find this parameter.

Like gebadia likes this

Comment

Log in or Sign up to comment
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

4,142 views 4 22
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