Create Repository
Creates a new repository.
Note: In order to set the project for the newly created repository, pass in either the project key or the project UUID as part of the request body as shown in the examples below:
$ curl -X POST -H "Content-Type: application/json" -d '{
"scm": "git",
"project": {
"key": "MARS"
}
}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding
or
$ curl -X POST -H "Content-Type: application/json" -d '{
"scm": "git",
"project": {
"key": "{ba516952-992a-4c2d-acbd-17d502922f96}"
}
}' https://api.bitbucket.org/2.0/repositories/teamsinspace/hablanding
The project must be assigned for all repositories. If the project is not provided, the repository is automatically assigned to the oldest project in the workspace.
Note: In the examples above, the workspace ID teamsinspace
,
and/or the repository name hablanding
can be replaced by UUIDs.
External Documentation
To learn more, visit the Bitbucket documentation.
Parameters
Parameter | Description |
---|---|
Default Branch | A ref object, representing a branch or tag in a repository. |
Description | - |
Fork Policy | Controls the rules for forking this repository.
|
Has Issues | - |
Has Wiki | - |
Is Private | - |
Language | - |
Project | A Bitbucket project that the repository is a part of.Projects are used by teams to organize repositories.By default, uses the oldest project. |
Repo Name | - |
Repo Slug | This can either be the repository slug or the UUID of the repository,surrounded by curly-braces, for example: {repository UUID} . |
Workspace Slug | This can either be the workspace ID (slug) or the workspace UUIDsurrounded by curly-braces, for example: {workspace UUID} . |
Example Output
{
"created_on": "2018-06-20T23:17:33.616Z",
"description": "A repository for my bits and bobs",
"fork_policy": "allow_forks",
"full_name": "example-username/bits_and_bobs",
"has_issues": false,
"has_wiki": false,
"is_private": true,
"language": "python",
"links": {
"avatar": {
"href": "https://bytebucket.org/ravatar/%7B7708d810-964c-403f-aa6d-4e949280d614%7D?ts=python"
},
"branches": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/refs/branches"
},
"clone": [
{
"href": "https://bitbucket.org/example-username/bits_and_bobs.git",
"name": "https"
},
{
"href": "git@bitbucket.org:example-username/bits_and_bobs.git",
"name": "ssh"
}
],
"commits": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/commits"
},
"downloads": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/downloads"
},
"forks": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/forks"
},
"html": {
"href": "https://bitbucket.org/example-username/bits_and_bobs"
},
"pullrequests": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/pullrequests"
},
"self": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs"
},
"source": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/src"
},
"tags": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/refs/tags"
},
"watchers": {
"href": "https://api.bitbucket.org/2.0/repositories/example-username/bits_and_bobs/watchers"
}
},
"mainbranch": {
"name": "master",
"type": "branch"
},
"name": "bits_and_bobs",
"owner": {
"account_id": "123456:daffbc08-1a80-4bd0-98bf-7997de0a3d10",
"display_name": "Example Username",
"links": {
"avatar": {
"href": "https://bitbucket.org/account/example-username/avatar/"
},
"html": {
"href": "https://bitbucket.org/example-username/"
},
"self": {
"href": "https://api.bitbucket.org/2.0/users/example-username"
}
},
"nickname": "example-username",
"type": "user",
"username": "example-username",
"uuid": "{58021780-82b6-4517-b153-0ae73ce3e4b4}"
},
"scm": "git",
"size": 33348,
"slug": "bits_and_bobs",
"type": "repository",
"updated_on": "2018-06-20T23:17:33.616Z",
"uuid": "{7708d810-964c-403f-aa6d-4e949280d614}",
"website": "www.example.com"
}
Workflow Library Example
Create Repository with Bitbucket and Send Results Via Email
Preview this Workflow on desktop