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); }
Go to Personal Settings and then App Passwords as shown below.
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.
By sharing your App password you're giving direct, authenticated access to everything that password has permissions to do with the Bitbucket APIs.
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With