我们不是在讨论SSH,因为它尚未实现,但在通过HTTP / HTTPS执行提取之前,如何为存储库提供凭据?似乎没有Credentials实例的参数,在构建存储凭证的Repository实例时没有任何参数。
答案 0 :(得分:4)
在 FetchFixture.cs 文件中,有一个 Fetch() test using credentials :
[SkippableFact]
public void CanFetchIntoAnEmptyRepositoryWithCredentials()
{
InconclusiveIf(() => string.IsNullOrEmpty(Constants.PrivateRepoUrl),
"Populate Constants.PrivateRepo* to run this test");
string repoPath = InitNewRepository();
using (var repo = new Repository(repoPath))
{
Remote remote = repo.Network.Remotes.Add(remoteName, Constants.PrivateRepoUrl);
// Perform the actual fetch
repo.Network.Fetch(remote, new FetchOptions
{
Credentials = new Credentials
{
Username = Constants.PrivateRepoUsername,
Password = Constants.PrivateRepoPassword
}
});
}
}