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

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do you clone a repository from Bit Bucket server using a personal access token?

How do you clone a repository on bit bucket server over https using personal access tokens?

I have tried using x-token-auth but i think that is only for bit bucket cloud.

 

 

1 answer

1 accepted

0 votes
Answer accepted
Mark A_ Atlassian Team Mar 16, 2018

Hey @John Lawlor

It looks like you were able to get this answered via Support Request, but I would like to post that answer and info for others as well. 

Here is an example curl call from our personal access tokens page for Bitbucket Server:

curl -H "Authorization: Bearer MDM0MjM5NDc2MDxxxxxxxxxxxxxxxxxxxxx" 
http://localhost:7990/bitbucket/rest/api/1.0/projects/WORK/repos/my-repo/commits/?until=master

Note that this is only supported via the REST API over Basic Auth (HTTPS) and cannot be used in the Git client.

Cheers,

Mark

Hi Mark,

Thanks for your reply. I have used the personal access tokens before with curl but what I was looking for was a method to clone a repository:

git clone https://x-token-auth:{access_token}@bitbucket.org/user/repo.git

It looks like this is only supported in Bitbucket Cloud, not Bitbucket server. 

Regards,

John

When using a personal access token you need to supply your Bitbucket Server username in your git command. I couldn't find this documented anywhere by Atlassian.

git clone https://{username}:{access_token}@yourbitbucket.org/user/repo.git
Like # people like this

git clone https://{username}:{access_token}@bitbucket.org/user/repo.git if I pass the username like 'user@bitbucket.com' and access_token will be something like this 'Basic XXXXXXX'. Then I am getting an error.

Like Darko Pilav likes this

I don't know for sure but I'm guessing that you'll need to use the user slug rather than username. That means you'll need either just the "user" bit or the whole thing but with the special character ("@") encoded, probably something like "user%40bitbucket.com"

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,903 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you