How to create bitbucket repository using curl?

Member

by lew , in category: Javascript , 6 days ago

How to create bitbucket repository using curl?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by brandy , 5 days ago

@lew 

To create a Bitbucket repository using curl, you can follow these steps:

  1. Obtain your Bitbucket username and password or generate an App password for authentication purposes.
  2. Use the following curl command to create a new repository on Bitbucket:
1
curl -X POST -H "Authorization: Basic BASE64_ENCODED_USERNAME_AND_PASSWORD" -H "Content-Type: application/json" -d '{"scm": "git", "is_private": "true", "name": "REPO_NAME"}' https://api.bitbucket.org/2.0/repositories/USERNAME


Replace BASE64_ENCODED_USERNAME_AND_PASSWORD with your Base64 encoded username and password. You can generate the Base64 string using websites like https://www.base64encode.org/.


Replace REPO_NAME with the desired name for your new repository.

  1. Run the curl command in your terminal. If the command is successful, you will receive a response containing information about the newly created repository.


Keep in mind that creating repositories via the API will count towards your Bitbucket account's plan limits and will consume your account's resources.