Дополнительная справочная информация. Это веб-приложение, которое я пытаюсь реализовать, в котором пользователь может загружать различные файлы из моих локальных клонированных папок репозитория git. Поэтому каждый раз, когда кто-то пытается загрузить, я пытаюсь получить и получить последние данные на моем локальном диске.
Код: Выделить всё
var path = "my local drive path";
using (var repo = new Repository(path))
{
FetchOptions options = new FetchOptions();
options.CredentialsProvider = new CredentialsHandler((url, usernameFromUrl, types) =>
new UsernamePasswordCredentials()
{
Username="[email protected]",
Password = "mypassword"
});
foreach (Remote remote in repo.Network.Remotes)
{
IEnumerable refSpecs = remote.FetchRefSpecs.Select(x => x.Specification);
Commands.Fetch(repo, remote.Name, refSpecs, options, logMessage);
}
}
//Console.WriteLine(logMessage);
using (var repo = new Repository(path))
{
// Credential information to fetch
LibGit2Sharp.PullOptions options = new LibGit2Sharp.PullOptions();
options.FetchOptions = new FetchOptions();
options.FetchOptions.CredentialsProvider = new CredentialsHandler(
(url, usernameFromUrl, types) =>
new UsernamePasswordCredentials()
{
Username = "[email protected]",
Password = "my password"
});
// User information to create a merge commit
var signature = new LibGit2Sharp.Signature(
new Identity("xxxx", "[email protected]"), DateTimeOffset.Now);
// Pull
Commands.Pull(repo, signature, options);
}
Может кто-нибудь мне с этим помочь?
Подробнее здесь: https://stackoverflow.com/questions/630 ... cess-token