v2

latestOpenAPI 3.0.02026-08-013312111.4 MB
Repositories

Fork a repository

Creates a new fork of the specified repository.

Forking a repository

To create a fork, specify the workspace explicitly as part of the request body:

$ curl -X POST -u jdoe https://api.bitbucket.org/2.0/repositories/atlassian/bbql/forks \
  -H 'Content-Type: application/json' -d '{
    "name": "bbql_fork",
    "workspace": {
      "slug": "atlassian"
    }
}'

To fork a repository into the same workspace, also specify a new name.

When you specify a value for name, it will also affect the slug. The slug is reflected in the repository URL of the new fork. It is derived from name by substituting non-ASCII characters, removes whitespace, and changes characters to lower case. For example, My repo would turn into my_repo.

You need contributor access to create new forks within a workspace.

Change the properties of a new fork

By default the fork inherits most of its properties from the parent. However, since the optional POST body document follows the normal repository JSON schema and you can override the new fork's properties.

Properties that can be overridden include:

  • description
  • fork_policy
  • language
  • mainbranch
  • is_private (note that a private repo's fork_policy might prohibit the creation of public forks, in which is_private=False would fail)
  • has_issues (to initialize or disable the new repo's issue tracker -- note that the actual contents of the parent repository's issue tracker are not copied during forking)
  • has_wiki (to initialize or disable the new repo's wiki -- note that the actual contents of the parent repository's wiki are not copied during forking)
  • project (when forking into a private project, the fork's is_private must be true)

Properties that cannot be modified include:

  • scm
  • parent
  • full_name
post/repositories/{workspace}/{repo_slug}/forks

Request body

typestring required
uuidstring

The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.

full_namestring

The concatenation of the repository owner's username and the slugified name, e.g. "evzijst/interruptingcow". This is the same string used in Bitbucket URLs.

is_privateboolean
scm'git'
namestring
descriptionstring
created_onstring date-time
updated_onstring date-time
sizeinteger
languagestring
has_issuesboolean

The issue tracker for this repository is enabled. Issue Tracker features are not supported for repositories in workspaces administered through admin.atlassian.com.

has_wikiboolean

The wiki for this repository is enabled. Wiki features are not supported for repositories in workspaces administered through admin.atlassian.com.

fork_policy'allow_forks' | 'no_public_forks' | 'no_forks'

Controls the rules for forking this repository.

  • allow_forks: unrestricted forking
  • no_public_forks: restrict forking to private forks (forks cannot be made public later)
  • no_forks: deny all forking

Response

The newly created fork.

typestring required
uuidstring

The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.

full_namestring

The concatenation of the repository owner's username and the slugified name, e.g. "evzijst/interruptingcow". This is the same string used in Bitbucket URLs.

is_privateboolean
scm'git'
namestring
descriptionstring
created_onstring date-time
updated_onstring date-time
sizeinteger
languagestring
has_issuesboolean

The issue tracker for this repository is enabled. Issue Tracker features are not supported for repositories in workspaces administered through admin.atlassian.com.

has_wikiboolean

The wiki for this repository is enabled. Wiki features are not supported for repositories in workspaces administered through admin.atlassian.com.

fork_policy'allow_forks' | 'no_public_forks' | 'no_forks'

Controls the rules for forking this repository.

  • allow_forks: unrestricted forking
  • no_public_forks: restrict forking to private forks (forks cannot be made public later)
  • no_forks: deny all forking