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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.