Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloning Bitbucket server repo with access tokens

Tags:

I am trying to clone a bitbucket server repo (self-hosted) using access-token however I could not find any documentation on Bitbucket server API. My clone url is ssh based.

Or is there a way to use REST API curl command to clone bitbucket server repos?

like image 688
Kaushal Kapoor Avatar asked Jun 25 '19 18:06

Kaushal Kapoor


1 Answers

The official documentation says that you should:

git clone https://x-token-auth:$ACCESS_TOKEN@yourbitbucketserver/...

In my experiments with a BitBucket 6.1 server, this does not work and gives HTTP 401 instead. Using ssh with access tokens seems to be entirely unsupported.

What did work was:

git -c "http.extraHeader=Authorization: Bearer $ACCESS_TOKEN" clone https://yourbitbucketserver/...
like image 140
Helmut Avatar answered Nov 30 '22 11:11

Helmut