我已经创建了一个应用程序的密码作为解释这里
但是现在,如何使用此应用密码访问存储库?
什么是网址?
有人可以指导我到一个显示示例的页面吗?
以下是github的代码.我如何为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);
}
Run Code Online (Sandbox Code Playgroud) bitbucket ×1