Questions tagged [libgit2]

libgit2 is a portable, pure C implementation of the Git core methods provided as a re-entrant linkable library with a solid API, allowing you to write native speed custom Git applications in any language which supports C bindings.

libgit2 is a portable, pure C implementation of the Git core methods provided as a re-entrant linkable library with a solid API, allowing you to write native speed custom Git applications in any language which supports C bindings.

It is under active development, spear-headed by GitHub and Microsoft.

Along with the C API, bindings exists for many languages, including Ruby, .Net, Python and Objective-C.

629 questions
6
votes
2 answers

Ignore multiline comments git diff

I'm trying to find the significant differences in C/C++ source code in which only source code changes. I know you can use the git diff -G but it seems very limiting in the kind of regexes that can be run. For example, it doesn't seem to offer…
onetwopunch
  • 3,279
  • 2
  • 29
  • 44
6
votes
1 answer

How to push (with libgit2)

How do I do a push with libgit2? (Like git push origin master on console) I want to use the C version. Cloning, opening, adding files to index and committing work like a charm (see code). The test-bare-repository is local. Unfortunately, reference…
pasbi
  • 2,037
  • 1
  • 20
  • 32
6
votes
1 answer

How to clone git repository with nodegit using ssh

I'm trying to clone git repository from our teamforge server in node.js using library nodegit (version 0.2.4) and ssh. Our server requests authentication from user and when I was trying to use only clone method without passing options I was getting…
yezior
  • 867
  • 11
  • 18
6
votes
1 answer

How to programmatically create a commit with Rugged?

I am trying to programmatically create a commit to an existing repository using Rugged (the Ruby binding of libgit2). I have tried to follow the documentation provided in the Rugged README, but I think it doesn't quite match up with the current…
jbranchaud
  • 5,909
  • 9
  • 45
  • 70
6
votes
1 answer

add blobs or trees to a created repository using pygit2 (libgit2)?

I am trying to use pygit2 library. seems I got stuck on the first step. its documentation doesn't explain how to create a blob and add it to a tree. It is mostly around how to work with an existing git repository but I want to create one and add…
Peqi Hash
  • 61
  • 2
5
votes
3 answers

Find out the branch a commit belongs to in LibGit2Sharp?

I am looping through commits in LibGit2Sharp: Repository repo = new Repository("Z:/www/gg"); foreach (LibGit2Sharp.Commit commit in repo.Commits) { ... } I can retrieve properties like Author and Message, but I do not see anything about what…
Tower
  • 98,741
  • 129
  • 357
  • 507
5
votes
1 answer

How to clone/fetch a git repository with libgit2?

I need to initialize a git repository and fetch the latest version of a branch into it. In bash, the commands are: git init git remote add -t $BRANCH -f origin $REMOTE I'm trying to do the same programmatically with libgit2, but am having trouble…
ssube
  • 47,010
  • 7
  • 103
  • 140
5
votes
1 answer

How is "git pull" done with the git2-rs Rust crate?

I'm using git2-rs to implement some standard git functionality in a Rust application. I've been reading up on git internals and understand that at a high level "git pull" is a "git fetch" followed by a "git merge", but am still having trouble…
jmwright
  • 131
  • 1
  • 7
5
votes
3 answers

Which format should be SSH private key for LibGit2 LibGit2Sharp (+SSH)

I´m kind of stuck with an SSH private key issue and LibGit2Sharp-Ssh. I have a .Net/C# application that uses LibGit2Sharp-Ssh to clone a Git repository. I need to use SSH (https with user/password is not an option) and I also have a valid key, which…
emvoll
  • 99
  • 7
5
votes
2 answers

How to obtain number of commits behind/ahead with libgit2sharp?

It's possible to obtain the number of commits behind/ahead using git rev-list command. I am trying to achieve the same thing using libgit2sharp library but the library is not fully documented so I couldn't find how to. I'm looking for an example for…
Ferit
  • 8,692
  • 8
  • 34
  • 59
5
votes
2 answers

How to include libgit2 via cmake

How can i include libgit2 as a library in cmake. I have cloned the libgit2 repository from github. than I ran mkdir build && cd build cmake .. make sudo make install Than I found the installed files under /usr/local/include/git2/ and…
Arwed Mett
  • 2,614
  • 1
  • 22
  • 35
5
votes
1 answer

What transfer protocols does libgit2 support for cloning?

I'm writing a program that can take a Git clone URI and make a clone of the repository on the user's machine. To do this, the program needs to know when it can go ahead with the cloning, and when it needs to give up. The man page for git-clone says…
5
votes
1 answer

libgit2 (fetch & merge & commit)

I 'm trying to pull from a repo with libgit2. My steps are these: git_remote_connect - OK git_remote_download or should I use git_remote_fetch ? git_remote_ls to get the of the HEAD to pass to git_annotated_commit_from_fetchhead (is this coorect?).…
Michael Chourdakis
  • 10,345
  • 3
  • 42
  • 78
5
votes
1 answer

Implementing Pull with Pygit2

I am trying to implement some 'porcelain' commands using pygit2. It seems that I have run into a bit of road block while implementing pull. Specifically the easiest pull case, a fast forward. Setup: I have two git repos. One 'remote' and one…
Michael Boselowitz
  • 3,012
  • 1
  • 19
  • 22
5
votes
4 answers

LibGit2Sharp: Fetching fails with "Too many redirects or authentication replays"

Here's the code I'm using to fetch: public static void GitFetch() { var creds = new UsernamePasswordCredentials() {Username = "user", Password = "pass"}; var fetchOpts = new FetchOptions {Credentials =…
Rovin Bhandari
  • 445
  • 1
  • 4
  • 12