Questions tagged [libgit2sharp]

.NET and Mono open source bindings for libgit2, a native Git library

LibGit2Sharp is an thin .NET/Mono layer wrapping the libgit2 linkable C Git library.

It provides a very opiniated API which should be very easy to use and discover.

Online resources

503 questions
23
votes
3 answers

How to retrieve the history of a file?

I got another libgit2 issue and will be very grateful for your help. I'm trying to retrieve file history, i.e. list of commits where this file was changed. And it seems to be quite unconventional... As far as I can see, there are no function for…
shytikov
  • 9,155
  • 8
  • 56
  • 103
21
votes
3 answers

How to detect pending changes in libgit2sharp?

In libgit2sharp https://github.com/libgit2/libgit2sharp/ how do you check for pending/uncommitted changes?
Simon
  • 33,714
  • 21
  • 133
  • 202
20
votes
2 answers

How to get the current/active branch with LibGit2Sharp?

So using LibGit2Sharp https://github.com/libgit2/libgit2sharp you can walk through the branches like this using (var repo = new Repository(@"path to .git")) { foreach (var branch in repo.Branches) { Debug.WriteLine(branch.Name); …
Simon
  • 33,714
  • 21
  • 133
  • 202
16
votes
1 answer

Get files modified/added/removed from a commit in LibGit2Sharp

I've this method, where I get files from my last commit: static void GetFiles(Tree t, String dir = "") { foreach (TreeEntry treeEntry in t) { if (treeEntry.TargetType == TreeEntryTargetType.Tree) { Tree tr =…
Carlos
  • 357
  • 4
  • 21
14
votes
5 answers

LibGit2Sharp DllNotFoundException: Unable to load DLL 'git2-106a5f2'

I am working on a vsix project where I need to get information about a local git directory. I am following this article. When I am using LibGit2Sharp library, I am getting an exception as described in following image and error:- How can I resolve…
Tanmay Bairagi
  • 564
  • 5
  • 25
13
votes
1 answer

Git repository internal format explained

Is there any documentation on how Git stores files in his repository? I'm try to search over the Internet, but no usable results. Maybe I'm using incorrect query or maybe this is great secret — Git repository internal format? Let me explain, why I…
shytikov
  • 9,155
  • 8
  • 56
  • 103
12
votes
2 answers

C# Push Files to Bitbucket repository from an Azure App Service?

I want to push files from a folder on Azure App Service to a Git repository. I have copied the local git repo up to the server and I'm using LibGit2Sharp to commit and push these files: using (var repo = new…
Paolo B
  • 3,026
  • 5
  • 21
  • 43
12
votes
1 answer

How to use libgit2sharp to create a new branch from local to remote?

I want to create and delete a branch on git using libgit2sharp. I came up with this code but it throws an error at repo.Network.Push(localBranch, pushOptions); using (var repo = new Repository(GIT_PATH)) { var branch =…
Anonymous
  • 9,366
  • 22
  • 83
  • 133
11
votes
4 answers

What is the LibGit2Sharp equivalent of git log path?

How do I get a list of commits which contain a particular file, ie the equivalent of git log path for LibGit2Sharp. Has it not been implemented or is there a way that I'm missing?
toofarsideways
  • 3,956
  • 2
  • 31
  • 51
10
votes
1 answer

Delete Remote Branch

I need to delete a remote branch, and found this technique: git push origin :the_remote_branch I tried passing it to Networks Push method in the following forms, but nothing seems to work (options is my login…
user2509848
10
votes
1 answer

How to get file's contents on Git using LibGit2Sharp?

I checked code in BlobFixture.cs and found some tests about reading file's contents like below. using (var repo = new Repository(BareTestRepoPath)) { var blob = repo.Lookup("a8233120f6ad708f843d861ce2b7228ec4e3dec6"); var…
Anonymous
  • 9,366
  • 22
  • 83
  • 133
9
votes
2 answers

costura.fody for a dll that references another dll

I have a small exe I've written that uses LibGit2Sharp and am trying to use Costura.Fody to embed everything so I only have a single exe to distribute (actually, there are two config files as well, but that's ok). The problem seems to be that…
Keith
  • 777
  • 8
  • 27
9
votes
2 answers

Programmatically delete local repository with LibGit2Sharp

I would like to delete the local repo folder that I cloned from remote repository using LibGit2Sharp. I read here here that I have to Dispose() the Repository before I can delete it, but it still not works fine. using (var repo = new…
Gábor Domonkos
  • 1,081
  • 1
  • 17
  • 33
9
votes
2 answers

how to commit and push in libgit2sharp

I just downloaded the nugget package for libgit2sharp. I am finding it difficult to do even basic operations. I have an existing git repo (both remote and local). I just need to commit new changes when it occurs and push it to the remote. I have…
user3900196
  • 457
  • 2
  • 6
  • 18
9
votes
2 answers

How to use libgit2sharp with ssh-transport-protocol?

When I use libgit2sharp in project to clone repository with ssh-transport protocol, like git@github.com:libgit2/libgit2sharp.git It throw an exception, says "This transport isn't implemented. Sorry" How can I clone repository with…
hutusi
  • 437
  • 6
  • 14
1
2 3
33 34