Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Fork the repo using rest api 2.0

Sangameshwar Sangaeshwar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 30, 2022

Hi Team, 

I am planning to Fork a repo from existing repo in same workspace, and as I see this can be achieved with rest api 2.0. While doing as described in the documentation facing 

{
"type": "error",
"error": {
"message": "Something went wrong",
"id": "71d7d97157e045ce8dd74348e52384f8"
}
}
below is my request  
Body : 
{
"name": "helloworld",
"workspace": {
"slug": "sangameshwar550"
}
}
my workspace id is sangameshwar550 &  my existing repo is helloworld and I want to name the new repo as hellow_react
Am I missing anything here. 
Best Regards,
Sanga 

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 31, 2022

Hi @Sangameshwar Sangaeshwar

Welcome to the community.

Based on the error message ID, it seems you can't rename the public repository because the project it's on is set as "private".

For this, you'll need to make sure your project setting is set to public.
You can check this by going to your project setting:

  1. Go to your workspace - https://bitbucket.org/workspace_id/
  2. Click Projects
  3. Click the project name
  4. Click Project settings
  5. Under Privacy, make sure "Private project" is unchecked

Also, to rename a repository, the below CURL command works for me.

curl -X PUT -u bb_username:app_password -H 'Content-Type: application/json' "https://api.bitbucket.org/2.0/repositories/workspace_id/repo_name" -d '{"name": "new_repo_name"}'

Here, you'll need to use your Bitbucket Cloud username and an App password

You can also check this documentation about it.

Hope it helps and let me know how it goes.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events