Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-22568

Cannot create a repo via /2.0/repositories/{workspace}/{repo_slug} with PAT

XMLWordPrintable

      Issue Summary

      Cannot create a repo via /2.0/repositories/{workspace}/{repo_slug} with project access token (PAT)

      Steps to Reproduce

      1. create a PAT from project settings with scope repository:admin
      2. try creating a repository using create repository API endpoint

      Expected Results

      The repository should be created

      Actual Results

      The below error is thrown in the API response:

      {
      	"type": "error",
      	"error": {
      		"message": "You do not have access to view this workspace."
      	}
      }
      

      Workaround

      • Use an App password for authentication instead of an access token

      Example:

      curl --request POST \
      --url 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}' \
      --user '{username}:{app_apssword}' \
      --header 'Content-Type: application/json' \
      --data '{
          "is_private": "true",
          "scm": "git",
          "project": {
              "key": "TEST"
              }
          }'
      

              Unassigned Unassigned
              f2cc5e9850cf Suhas Sundararaju
              Votes:
              16 Vote for this issue
              Watchers:
              17 Start watching this issue

                Created:
                Updated: