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.
At a minimum, the input file has to contain the name of the repository:
{
"name": "My Repository"
}
To enable the "Public access" while creating the repository, this is how to define the payload:
{
"name": "My Repository",
"public": true
}
A non forkable repository ("Allow forks" option unchecked) is created by using this input file:
{
"name": "My Repository",
"forkable": false
}
Caterina Curti
Developer Advocate
Sydney
109 accepted answers
Plan, prioritize, and deliver marketing projects seamlessly. See how Jira supports your team's success. Start today!
Start now! 🚦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.
5 comments