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
9
votes
1 answer

How to get the last commit from HEAD in a git repository using libGit2Sharp?

How can I get the last Commit from the current Head? I guess I need to get the current Branch (repo.Head), then the SHA1 (how?) and then lookup the commit using the SHA1 (how?).
zpete
  • 1,725
  • 2
  • 18
  • 31
8
votes
2 answers

Is any body making a windows replacement to msysgit with libgit2,libgit2sharp, Ngit?

Hi I like Git but it seems sharing windows projects with people and friends is not fun because gitextensions tortoisegit are ugly to use out of the box compared to tortoisehg or tortoisesvn (not that it's DVCS). Using msysgit just in a bash shell…
sabgenton
  • 1,823
  • 1
  • 12
  • 20
8
votes
1 answer

Get changes between a commit and its parent with libgit2sharp

I am working with libgit2sharp (a C# wrapper for libgit2) and have been running into issues because it doesnt have a lot of the functionality I am hoping for (hopefully I can contribute to it soon; this seems like a really useful project) The thing…
bashirs
  • 452
  • 1
  • 7
  • 14
8
votes
3 answers

How to find the branch a git commit is on? (Using libgit2sharp)

For a research project, I've been trying to replicate the graph view present in version control software like SourceTree or TortoiseGit. The graph view I'm trying to implement The biggest problem I'm having is finding what branch a commit belongs…
Jade White
  • 105
  • 2
  • 7
8
votes
2 answers

Changing the remote url of a repository in libgit2sharp

How can we change the remote url of a repository? using (var repository = new Repository(repositoryPath)) { //Change the remote url first //Then checkout }
Levent Esen
  • 559
  • 7
  • 18
8
votes
1 answer

How to check if a directory is a git repository in C#

I've started using LibGit2Sharp in my project and I have to admit its pretty awesome. I'm glad i didnt go the command line route with processinfo. But I have a question which I couldn't find an answer for in the wiki and could not find a test in…
wendellmva
  • 1,896
  • 1
  • 26
  • 33
8
votes
1 answer

LibGitSharp: Checkout Remote Branch

i try to Checkout a Remotebranch via LibGitSharp. In git itself you use this comands: git fetch origin git checkout -b test origin/test in newer Versions it is just: git fetch git checkout test So i tried this…
user3541236
  • 171
  • 2
  • 12
8
votes
3 answers

LibGit2Sharp The Index is locked - Error

Sometimes I try to read and write to a Git repository at the same time. But afterwards i get the following error message when i try to commit files: An error was raised by libgit2. Category = Index (LockedFile). The index is locked. This might be…
JoeLiBuDa
  • 219
  • 2
  • 10
8
votes
2 answers

What's the fastest way to find Tags pointing to Commits?

With libgit2sharp I would like to do the following: foreach( Commit commit in repo.Commits ) { // How to implement assignedTags? foreach( Tag tag in commit.assignedTags ) {} } I want to get all tags assigned to the current commit. Whats the…
zpete
  • 1,725
  • 2
  • 18
  • 31
8
votes
2 answers

What is the LibGit2Sharp equivalent of 'git pull'?

I'm trying to merge changes from the remote branch into the local repository, however I've been unable to get this to work properly -- likely misunderstanding of the implementation. Fetching seems to work fine, as I can see the updates on the…
Xaero Degreaz
  • 1,045
  • 11
  • 18
7
votes
1 answer

Pull a specific commit using libgit2sharp

hopefully someone call help. First off, I am pretty new to git, so forgive me if I make some mistakes in explaining my question. I would like to pull the source code as it exists up to a specific commit using the library using libgit2sharp. So if…
SpaceGhost440
  • 460
  • 4
  • 17
7
votes
1 answer

Trouble authenticating with SshUserKeyCredentials in libgit2sharp-SSH

Having some trouble authenticating with SshUserKeyCredentials using libgit2sharp-SSH: var co = new CloneOptions(); co.CredentialsProvider = (_url, _user, _cred) => new SshUserKeyCredentials { PrivateKey="C:\\path\\to\\private_key"…
Kim Lindqvist
  • 363
  • 4
  • 15
7
votes
1 answer

clone a git repository with SSH and libgit2sharp

I'm trying to use the library "libgit2sharp" to clone a repository via a SSH key and... I can't find anything... I can clone it via "https" but what I'd like to do is using an SSH key. It's really unclear if it is supported or not.
ssougnez
  • 5,315
  • 11
  • 46
  • 79
7
votes
3 answers

Programmatically do "Git blame -w" in C#

I need to programmatically get the last author of a specific line in the Git history with C#. I tried using libgit2sharp : var repo = new LibGit2Sharp.Repository(gitRepositoryPath); string relativePath = MakeRelativeSimple(filename); var blameHunks…
JYL
  • 8,228
  • 5
  • 39
  • 63
7
votes
1 answer

Deletion of git repository

Consider following program: var path = Path.Combine( Path.GetTempPath(), Path.GetFileNameWithoutExtension(Path.GetRandomFileName())); Directory.CreateDirectory(path); var testFile = Path.Combine(path,…
Rafal
  • 12,391
  • 32
  • 54
1
2
3
33 34