Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using BitBucket's API to fork a repository

There's any way to fork a repository using BB's API?

From what I've read on the API's docs, there isn't any explicit one: https://confluence.atlassian.com/display/BITBUCKET/Repositories

My idea is to create a new repo and point that it's a fork of another one, so I can create pull requests later.

like image 994
dmmd Avatar asked Oct 18 '25 02:10

dmmd


2 Answers

You can use the API to fork a repository, either using Basic authorization or OAuth.

The method to fork a repository:

Using a authorized POST-request with required post data "name". https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}/fork/

Full documentation with optional parameters here: http://restbrowser.bitbucket.org/

like image 90
Ogglas Avatar answered Oct 22 '25 04:10

Ogglas


So..

Tried to contact support via twitter and comments on the API page. Didn't get an answer...

And it seems that they really don't have a method to create forks.

My solution:

  • Created a cURL interface to interact with BitBucket's website, and from there I could fork and create pull requests

If you have a better solution for that, or if they actually have the method on the API, please fell free to drop your answer here.

Follow up: https://bitbucket.org/site/master/issue/4376/api-method-to-fork-a-repository

like image 28
dmmd Avatar answered Oct 22 '25 05:10

dmmd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!