RESTfully Creating a Repository in BitBucket.org

2013-06-02

Jitesh Doshi

RESTfully Creating a Repository in BitBucket.org

How to create BitBucket repositories via REST API using curl command.

Creating a Git repository is simple, using the excellent BitBucket.org service. It can be a chore to go to the bitbucket website and manually creating new repositories every time, though.

Since BitBucket provides a RESTful API, here’s how to create a new repository from ‘curl’ command-line:

curl --user login:pass https://api.bitbucket.org/1.0/repositories/ --data name=REPO_NAME

The above creates a ‘public’ repository. If you want a ‘private’ repository, then just add --data is_private=true:

curl --user login:pass https://api.bitbucket.org/1.0/repositories/ --data name=REPO_NAME --data is_private=true