Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access bitbucket using app password

Tags:

bitbucket

I have created an app password as explained here

But now, how do I access the repository using this app password?
What will be the url?
Can someone direct me to a page showing an example please?

The below is a code for github. How do I do it for bitbucket?

var githubToken = "[token]"; var url = "https://github.com/[username]/[repository]/archive/[sha1|tag].zip"; var path = @"[local path]";   using (var client = new System.Net.Http.HttpClient()) {     var credentials = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}:", githubToken);     credentials = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(credentials));     client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);     var contents = client.GetByteArrayAsync(url).Result;     System.IO.File.WriteAllBytes(path, contents); } 

Update

Go to Personal Settings and then App Passwords as shown below.

Create Bitbucket App Password

like image 695
VivekDev Avatar asked Oct 06 '16 03:10

VivekDev


People also ask

How do I use Bitbucket App password?

Under Settings, select Personal settings. On the sidebar, select App passwords. Select Create app password. Give the App password a name, usually related to the application that will use the password.

Why is Bitbucket asking for App password?

By sharing your App password you're giving direct, authenticated access to everything that password has permissions to do with the Bitbucket APIs.

How do I access Bitbucket?

User access on existing repositoriesClick Repository settings in the left sidebar navigation of the Bitbucket repository. Click User and group access on the left sidebar navigation. Select the Add members button. Enter the Bitbucket user's name or email address in the text box.


1 Answers

Since the question was "how do I access the repository" - maybe this is useful for somebody:
You can also use a Bitbucket "App Password" to use Git over HTTPS.

git clone https://USERNAME:[email protected]/OWNER/REPO.git 

(Or, if you want to avoid storing the password in plaintext:
Omit :APP_PASSWORD in the URL above, and just provide the App Password when prompted by Git.)

This may be useful for CI (although Git over SSH might be better).

like image 136
mh8020 Avatar answered Sep 21 '22 17:09

mh8020