简体   繁体   中英

How to upload a Zip File using Octokit?

How to upload a zip file using Octokit.net? I am new to Octokit.net anyone could you possible provide code snippet?

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM