Forums

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

How to use a Repositories HTTP Access token to Clone it

Tim
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!
July 21, 2022

I'm very confused about Bitbucket Repository HTTP Access Tokens (and your bitbucket docs seem to be very confused as well).

I found out that the feature is coming from a "plugin?": The URL of it in the settings is https://bitbucket.company.com/plugins/servlet/access-tokens/admin but i didn't find a plugin installed on our side that fits to the name so i assume it's a built-in one.

When i'm in the repo settings, i have a menu to create access tokens and a text that explain that i can clone the repo and interact with the rest api with this token.

I found out that the token is in fact a Bearer Token with which i can login with the website (dunno about api because the rest api is quite terrible and never really works for us).

What bothers me is the description of the Access Tokens which imply the possibility of using it with git clone.

bitbucketshit.png

And when i klick the link it shows a "Page not found page". And when i search in the docs for HTTP Access Token, i only get docs for Personal Access Tokens which are different.

Can someone clarify what's going on here? Can i use the token to clone the repo with basic auth? If yes, what's the username? Why are the docs so confusing? I'm lost here.

2 answers

1 vote
Yann Larhantec October 4, 2022

Hi Christian,

We have the same problem here.

I created a HTTP access tokens inside a repository.

I tried to :
git clone https://token_name:token@bitbucket....com/scm/xxx/test.git

And I get an fatal: Authentication failed

Do we miss something on how to use it ?

We're running on Bitbucket 7.21.4

And btw, the link Learn more about HTTP access tokens on top of the section targeting BITBUCKETSERVER0721 doesn't work.

Thx for your help

Regards

Yann

Ed Gomoliako
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!
February 19, 2025

It's not clear from the relevant documentation but it's mentioned there. 

You have to use the following syntax:

git clone -c http.extraHeader='Authorization: Bearer MDM0MjM5NDc2MDxxxxxxxxxxxxxxxxxxxxx' {your-repo}

 

Like timtatt likes this
0 votes
Christian Glockner
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 21, 2022

Hi Tim,

When it comes to git operations the token replaces the password. The username should be the user whom the token belongs to. For REST API operations you can specify the token in the Authorization header.

Cheers,

Christian

Premier Support Engineer

Atlassian

Tim
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!
July 22, 2022

I understand, but this isn't a personal access token. It's a HTTP Access Token i create in the Repository Settings.

I cannot use this access token with my own username to clone the repository. I'm getting an expected fatal: Authentication failed for Repoxyz error if i try this.

Piotr Kubiak
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!
January 25, 2023

Hi Christian,

Any update? I have the same problem.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events