问题
How to upload a zip file using Octokit.net? I am new to Octokit.net anyone could you possible provide code snippet?
回答1:
The ocktokit.net docs are quite complete, read the docs well.
This is an example from the docs:
var client = new GitHubClient(new ProductHeaderValue("my-cool-app"));
var basicAuth = new Credentials("username", "password"); // NOTE: not real credentials
client.Credentials = basicAuth;
using(var archiveContents = File.OpenRead("output.zip")) { // TODO: better sample
var assetUpload = new ReleaseAssetUpload()
{
FileName = "my-cool-project-1.0.zip",
ContentType = "application/zip",
RawData = archiveContents
};
var release = client.Repository.Release.Get("octokit", "octokit.net", 1);
var asset = await client.Repository.Release.UploadAsset(release, assetUpload);
}
来源:https://stackoverflow.com/questions/56521441/how-to-upload-a-zip-file-using-octokit