libgit2sharp

How to provide credentials to Fetch() and Pul() methods?

大憨熊 提交于 2019-12-12 10:04:14
问题 I'm looking for a nice clean example of how to do a pull using lidgit2sharp. I took the example here which does a fetch, but the reference to Credentials is throwing an exception. using (var repo = new Repository(workingDir, null)) { Remote remote = repo.Network.Remotes.Add("master", repoUrl); repo.Network.Fetch(remote, { Credentials credentials = new Credentials { Username = "username", Password = "password" } }); } The exception is Cannot create an instance of the abstract class or

How to easily get all Refs for a given Commit?

左心房为你撑大大i 提交于 2019-12-12 06:38:23
问题 Is there an easy way to find all References (e.g. Tags) for a given Commit? For example: using( Repository repo = new Repository( path_to_repo ) ) { foreach( Commit commit in repo.Commits ) { List<Reference> assignedRefs = commit.Refs; // <- how to do this? } } 回答1: The code below retrieves all the references that can reach the selected commit. using( Repository repo = new Repository( path_to_repo ) ) { foreach( Commit commit in repo.Commits ) { IEnumerable<Reference> refs = repo.Refs

Read the files at the spesific commit with libgit2sharp

江枫思渺然 提交于 2019-12-12 06:14:16
问题 There is a bare repository, I have a commit id, and want to read all the files at that commit without cloning. This repository.Lookup<Tree>(repository.Commits.First().Tree.Sha) code give me only the files that are in the commit but I want also other files that exists at that level. How to do that? 回答1: My understanding of your question is that you're willing to access the whole content of a commit, not only the first level of the commit. The code below will work against a bare (or a standard)

Is there a way to list all repositories in a Git Organization using Libgit2sharp?

旧巷老猫 提交于 2019-12-12 03:36:27
问题 Is there a way to list all repositories in a Git Organization using Libgit2sharp? I did check here https://github.com/libgit2/libgit2sharp/wiki. But seems like there are no wiki pages explaining "working with Git Organization"! 回答1: Libgit2sharp is a C# library for git. Git Organizations however are a GitHub construct and will be available only via the Github API. So the solution would be to write your own code to that integrates Libgit2sharp and the GitHub API 来源: https://stackoverflow.com

How can I skip SSL verification using libgit2sharp?

旧巷老猫 提交于 2019-12-12 03:23:26
问题 I am new to libgit2sharp (and git in general). I am trying to write a small program that handles multiple repositories in an unified manner. However, I've hit a brick wall when trying to deactivate the SSL verification. The library doesn't seem to provide an easy way to do this. I've found a branch (which seems to deal with the problem) and copied some code from there My current code looks like this (I've deleted personal stuff"): static void Main(string[] args) { //Additional code

Needing a little help performing operations on remote repository

雨燕双飞 提交于 2019-12-11 18:05:37
问题 I've been tinkering around, and reading through what little Wiki information that I could find, and looked through tests that I thought may be relevant, however I'm having problems coming up with a working solution for a few things. Mostly, I'm looking for a way to list commits that have been pushed to the server ahead of your working repository / local commits. I've tried using Fetch, and FetchHeads, but looking through all of the documentation for the Network class doesn't seem to yield

LibGit2Sharp fails to find git2.dll

最后都变了- 提交于 2019-12-11 15:33:56
问题 I have built a tiny wpf app that manages a website I am working on. The key feature of this app is that it allows me to checkout different branches of a theme repository. This works perfectly in visual studio, but when I publish, install and run the app on my windows 8 machine it comes back with: {"Unable to load DLL 'git2': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"} I have searched through the internet and stackoverflow. There are similar questions, such

Git Checkout and Pull through Lib2GitSharp

三世轮回 提交于 2019-12-11 13:36:23
问题 I am trying to build an application that periodically scans the commit history on various Git branches and reports on the authors and various details about the commit messages. I have started using LibGit2Sharp for this. It has been great for accessing the commits themselves, but I have run into a snag when trying to update the repository. Every time my task runs, I need to get the most recent changes from the remote repository. My understanding is I need to checkout the local branch that

How to skip SSL verification in LibGit2Sharp

天涯浪子 提交于 2019-12-11 11:29:06
问题 I recently started to use LibGit2Sharp and was able to start using this successfully. However, I am hitting one issue which I am unable to resolve related to SSL verification very similar to this one. For one of my scenario, I need to skip SSL verification. I get the following exception when I try this scenario. user cancelled certificate check: I tried using the solution mentioned in the link above which is as follows. RemoteCertificateValidationCallback certificateValidationCallback =

Programmatically delete directory of cloned repository

夙愿已清 提交于 2019-12-11 10:53:43
问题 I am using LibGit2Sharp to clone a remote repository into the windows temp folder. After my script has completed, I want to clean up. However, I always get the following error: SystemError: Access to the path 'pack-efcef325f8dc897099271fd0f3db6cf4d9f12393.idx' is denied. where pack-efcef325f8dc897099271fd0f3db6cf4d9f12393.idx is a file in $local_git_clone_path\objects\pack. How can I completely delete all local leftovers of the git repo I cloned using LibGit2Sharp ? 回答1: I remember having