Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Unable to disable forking of any repository in Bitbucket using API

aman.v June 2, 2023

I'm trying to disable fork in existing repo with below details using bitbucket API's:

1.

curl -X PUT \
--url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/hooks' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json'
--data '{
"fork_policy": "no_forks"
}'

2.

curl --request PUT --user username:password --header "Content-Type: application/json" --data '{"fork_policy": "no_forks"}' https://api.bitbucket.org/2.0/repositories/workspace/repo_name

In both the cases, it is giving the same error: This endpoint does not support token-based authenticationcurl: (6) Could not resolve host: Bitbucket

I've tried by replacing PUT by POST but still not getting the result

1 comment

aman.v June 25, 2023

I got the solution for above query:

 

curl --request PUT \

  --url 'https://api.bitbucket.org/2.0/repositories/workspace/repo_name' \

  --header 'Authorization: Bearer <access_token>' \

  --header 'Accept: application/json' \

  --header 'Content-Type: application/json' \

  --data '{ "fork_policy": "no_forks" }'

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events