2

I found Using BitBucket's API to fork a repository and this is helpful in so far as letting me know that creating a fork is possible.

However I want to create the fork in a certain project on the bitbucket server.

We have a use case where we want to create a fork of some repositories in another project and then merge back only the parts of the project that are re-usable not the project specific stuff.

Community
  • 1
  • 1
JamesD
  • 2,466
  • 24
  • 40

1 Answers1

4

Assuming you want to fork PRJ1/repo_AA as PRJ2/repo_BB, you can use:

curl -X POST -H 'Content-Type: application/json' \
     -d '{ "slug": "repo_BB", "name": "repo_BB", \
           "project": { "key": "PRJ2" } }'       \
     https://your.serv.er:7990/rest/api/1.1/projects/PRJ1/repo_AA

Be sure project PRJ2 already exists (you can create it via REST API as well) and have the correct credentials.

HTH

Regards

elbeho
  • 71
  • 5