使用 octokit.net 从 GitHub 下载代码

问题描述 投票:0回答:1

我想从 GitHub 的公共和私有存储库下载代码。为此,我选择了 octokit.net,但我很难理解应该如何使用这个库来实现我的目标。一般来说,应该通过新的 GitHubClient 类来完成。但是当我尝试下载代码 octokit.net 时,我收到错误消息,路径错误。

var github = new GitHubClient(new ProductHeaderValue("OctokitTests"), new Uri("https://github.com/octokit/octokit.net.git);
var repository = await github.Repository.Get("onwer", "user");
c# git github-api octokit
1个回答
6
投票

baseAddress
上的
GitHubClient
重载适用于您需要连接到 GitHub Enterprise 环境时。如果您只是连接到 github.com,则不需要指定它。

var client = new GitHubClient(new ProductHeaderValue("OctokitTests"));
var repository = await client.Repository.Get("octokit", "octokit.net");
© www.soinside.com 2019 - 2024. All rights reserved.