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.
590
questions
0
votes
0
answers
34
views
Is there a way to specify the ssh port to be used by libgit2
This code block works perfectly well if I use port 22 to connect in ssh (rather usual 22 basic port of ssh)
But for some reason, I need to connect to ssh on port 443. And at this moment the code doesn'...
0
votes
0
answers
33
views
After git_rebase_finish (), the HEAD pointer separately from the master branch
I am making an analogue of Git Pull --rebase using the Libgit2 library, the code is made without errors, but only I have Head in front of Master.
I cannot understand what the problem is.
Here is my ...
1
vote
0
answers
26
views
not able to push to github with `gert` or `git2r`
I'm trying to use gert or git2r to use git programmatically from R, but on git2r::push() I get:
Error in 'git2r_push': failed to send request: A connection with the server could not be established
or ...
0
votes
1
answer
51
views
Rust libgit2: how to add --force
How to do a git add --force * with libgit2 in Rust?
I tried the following code from the documentation:
use git2::{Index, IndexAddOption, Repository};
let repo = Repository::open("/path/to/a/repo&...
0
votes
1
answer
23
views
Identify Tag for detached HEAD
How can I identify the reference name for a detached HEAD in a repo where HEAD points to a Tag?
I'm using git_repository_head() and I noticed that in this state the returned reference is not a tag ...
1
vote
1
answer
55
views
Building a directory tree of tracked files with libgit2.sharp
not sure if I am on the right track here.
I have been trying to build a folder structure tree in Winforms by recursively building a DictionaryInfo object and with some hacking ignoring files and ...
0
votes
1
answer
27
views
git-rs leaving index in odd state
I'm using libgit2 via git-rs. I'm trying to commit things which is working, however, old files are showing up as deleted and/or staged even after the commit. How can I clean this up?
let repo: ...
1
vote
1
answer
64
views
Skip commit if no files are changed in git2/libgit2
I'm using the git2 crate which wraps libgit2.
I'm adding files to the index whether or not they are changed to stage them for committing.
If there are no files changed in the repo, when I commit, I ...
0
votes
1
answer
152
views
Nix how to simulate exact environment when a derivation is being built?
So I'm doing a simple thing in my rust project which is updating a dependency on git2 from 0.13.25 to 0.14.2. I want to then make a complete build with Nix. When I do a nix-build nix-build nix/ci -A ...
0
votes
0
answers
11
views
Is there any API in libgit2 which supports git's --cc (compact combined) option?
Is there any API in libgit2 which supports git-diff-tree "--cc" option ?
I want to know if a merge is clean or not (without merge conflict). Comparing patches from git_patch_from_diff() ...
2
votes
1
answer
294
views
LibGit2Sharp: How to push a local repo commit to Azure DevOps remote repo using a Personal Access Token inside a custom HTTP authentication header?
I am trying to push a commit I made on my local repository to a remote counterpart, hosted on a private Azure DevOps server, using LibGit2Sharp programmatically.
As per the Azure documentation, the ...
0
votes
0
answers
32
views
libgit2: How to mark resolution
I can't figure out how to mark a resolution after resolving merge conflicts with libgit2. calling git status on the repo returns Unmerged paths: and says both added: <'myfilename'>
Edit: Her is ...
0
votes
0
answers
30
views
How to use libgit2 for merge and revert
I'm working on a Swift iOS project that executes libgit2 git commands.
I have tried all other commands, but merge and revert are not working.
Is the merge procedure correct?
git_remote_fetch()
...
1
vote
0
answers
107
views
libgit2: Resolve merge conflict automatically
I'm writing a program that is using libgit2 with a repo for management of config files across multiple instances. If there is a conflicting merge I would like to automatically resolve this (by picking ...
1
vote
1
answer
44
views
How do I create a Time from a string in libgit2?
I'm trying to make a Git commit at a specific time. However, in the Rust docs, I don't see an easy way to create a new Time object. In command line Git, I can set the GIT_COMMITTER_DATE environment ...
1
vote
1
answer
45
views
How get list submodules from git bare repo without create working tree?
How get list submodules in git bare repo without create working tree?
(with low level library libgit2 or git console)?
0
votes
0
answers
44
views
libgit2 get content from older commit in C++
My problem seems quite simple but I seem to be on the wrong path on this.
I want to retreive an object from an older commit. What I have is she short OID (e.g. a6bcd4) to exactly this commit. There ...
1
vote
0
answers
54
views
How to get branch name if checked out to origin/branch with pygit2?
If the cloned repo is in detached HEAD state and points to origin/<branch>, how do I get the original branch name?
git status shows HEAD detached at origin/<branch>, so it should be ...
1
vote
0
answers
31
views
Conflict reason is not the same as Git CLI
I built the libgit2 example program (lg2) and tried its "merge" subcommand.
After issuing "lg2 merge", I ran "git status" to check the result of the merge.
I found that &...
0
votes
0
answers
17
views
Nodegit 'config value was not found' although exists
I use Nodegit (libgit2) :
const repo = NodeGit.Repository.open(path);
const config = await repo.config();
return config.getStringBuf('credential.helper');
and getting the error:
[Error: config value ...
0
votes
0
answers
711
views
How to store GitHub PAT(Personal Access Token) for app use
As I read at Creating a personal access token
and Where to store the personal access token from GitHub? I understand that Git requires from the user on the local machine at first use to enter PAT and ...
3
votes
2
answers
203
views
"invalid version 0 on git_proxy_options" from libgit2: cause? fix? walk-around?
I'm getting this error "invalid version 0 on git_proxy_options" from libgit2. This did not happen until very recently (I have recompiled my code so it may be a version issue). I'm not using ...
0
votes
1
answer
99
views
How to build/represent's worktree of git bare repo on memory with libgit2
I'm building a git server written in rust, I'm using git2 library that is a bindings of libgit2 for rust.
Actually i can create bare repository though the API, now i want build the worktree on memory ...
0
votes
1
answer
92
views
Why does libgit2 expose GIT_CREDENTIAL_DEFAULT as a credential type to the credential callback?
I've got a naive question about GIT_CREDENTIAL_DEFAULT. Why is it exposed to the credential callback that the clients have to implement? Can the transports not just handle this for the caller?
A ...
0
votes
0
answers
78
views
How to get git_remote_connect() http response code
In the case of a failed call to git_remote_connect(), is there any way to get the response HTTP response status code? I can use git_error_last() to get an error message of "unexpected http status ...
1
vote
0
answers
123
views
How to clone public git repository with LibGit2 in Swift?
I am using libgit2 library to clone repository in iOS with swift language. I am able to clone repository by passing username and password
internal func credentialsCallback(
cred: ...
0
votes
1
answer
118
views
How to get the behavior of `git diff master <commit>:<directory>` in Rust git2
I want to compare my local repository only with a sub-directory of my remote. Though native git command, I can achieve this by:
git diff master <a remote commit>:>directory>
How can I ...
-1
votes
1
answer
139
views
Libgit2 how to discard/revert changes if the file
I'm searching a way to discard all changes of file with path.
in libGit2Sharp there is exist method
CheckoutOptions options = new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force };
repo....
1
vote
0
answers
138
views
Get git diff between two paths in rust
My goal is to get the diff between two source code repositories in rust. With native git command I can do this by performing git diff [path1] [path2]. Can I do similar analysis through some crate like ...
0
votes
1
answer
280
views
rugged gem failing to build native extension
OS: Ubuntu 18.04
GCC version: gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
JRuby version: 9.2.8.0
Ruby version: 2.5.3
Issue origin: Trying to install pronto gem (version 0.11.0)
While running ...
2
votes
1
answer
217
views
Git2-rs status of files in commit log
Can I find out in Git2-rs / libgit2 about the status of a file like added/removed/modified from the commit log? I've looked at the documentation but only find Diff Trees.
1
vote
1
answer
158
views
Does libgit2 support --filter=blob:none
Is there a way to only read the history without the files in libgit2? e.g. something like git --filter=blob:none ?
1
vote
1
answer
60
views
No instance for (Git.Libgit2.HasLgRepo IO) arising from a use of ‘lookupBlob’
I am trying to get list of all files in HEAD commit from a git repository using gitlib. Here is my code:
{-# LANGUAGE OverloadedStrings #-}
module GitOperations where
import Git
import Git.Libgit2 (...
1
vote
1
answer
157
views
libgit2 dependency pcre not present in build
I'm building a C++ app which uses the libgit2 library to interact with a git repo. I've installed libgit2 through vcpkg, which also installed the pcre library which libgit2 needs. So far, so good. ...
1
vote
1
answer
443
views
How to push single commit to remote branch libgit2sharp
I'm trying to push a single specific commit to a remote branch using LibGit2Sharp.
I'm looking for the equivalent of git push <remote name> <commit hash>:<remote branch name>
https://...
0
votes
1
answer
62
views
Does libgit2 support a ssh config host alias?
I am using a ssh host alias, as in:
.ssh/config
Host my-git-host
HostName github.com
And the command-line git works for push/pull/clone using my-git-host as a remote etc.
But would this also work ...
3
votes
1
answer
150
views
LibGit2 Implementing 'git pull'
I have choose the following algorythm of pull:
fetch()
get current head commit
get all not merged commits (realisation taken from here: How can I check if pull is needed using libgit2 in c++?)
get ...
-1
votes
1
answer
130
views
Using git2go clone on CloudRun
I'm trying to use https://github.com/libgit2/git2go for cloning repository from GCP Source repository
But, I'm getting failed to resolve path '/tmp/repo/.git/': No such file or directory"
By ...
1
vote
0
answers
37
views
Determine if a commit author is uninitalized
I am trying to use the libgit2 API in my program. I have to traverse through the commits and compare a commit to its parent and I also need the author of each modification. I am testing the program on ...
1
vote
0
answers
34
views
(libgit2) Determine whether a push/fetch refspec requires force
The man pages for git-fetch(1) and git-push(1) specify complex semantics for when a push/fetch refspec is allowed without push. For example, refs/heads only accepts commits but allows fast forward, ...
0
votes
0
answers
54
views
libgit2 pathspec match single folder non recursive
With git I can use glob style pathspec patterns to match a single folder without its subdirectories:
git status ':(glob)*' // matches root but no subdirectories
git status ':(glob)myFolder/*'...
2
votes
1
answer
113
views
Rebase using libgit2
int rebase(const char *onto_str)
{
git_rebase_options opts = GIT_REBASE_OPTIONS_INIT;
git_repository_head(&head, repo);
git_annotated_commit_from_ref(&branch, repo, head);
...
0
votes
1
answer
3k
views
installation of package ‘devtools’ had non-zero exit status - R packge or R studio
R version 3.4.4. Ubuntu 18.04.5 LTS.
install.packages('devtools')
The output shows missing "gert", "usethis".
Then I tried to install the failed packages "gert".
install....
0
votes
0
answers
108
views
Dynamic linking libgit2 .so in gcc
I'm running a Debian (Buster) container and my goal is to compile a small program I wrote which relies on libgit2. First, I was installing libgit2 via the libgit2-dev package and my Makefile had the ...
0
votes
1
answer
55
views
Failed to install libgit2 on linux
install.packages("libgit2")enter image description here
Installing package into â/ldfssz1/ST_INFECTION/P17Z10200N0246_Phage_XMF/USER/luoyunzhe/software/Rlibraryâ
(as âlibâ is unspecified)
...
2
votes
0
answers
272
views
Unable to install libgit2 library on AMI ec2 instance
I am trying to install devtools in a R ami on an amazon ec2 instance. However, before devtools, I need to install some variation of a libgit2 library as a dependency. Given that the amazon distro is ...
7
votes
1
answer
388
views
How to add a custom object database to libgit2?
I try to understand how to implement a custom object database in libgit2. As the main entry point I already checked out the example repository called libgit2-backends which implements examples for ...
0
votes
1
answer
76
views
Disabling git packing in libgit2
I am using libgit2 and try to find a way to disable packing/zipping of git objects. Does git or libgit have a configuration to completely disable that?
In specific, I would need a full copy of the ...
1
vote
2
answers
4k
views
Configuration failed to find libgit2 library
When attempting to install the R devtoolspackage (on Linux Mint, 19.3 & R 4.0.2),I receive this error. In the ANTICONF section the message offers some suggestions for what I should do, but being ...
0
votes
2
answers
1k
views
In R: git2r_remote_ls': Failed to retrieve list of SSH authentication methods
I have an issue on installing packages from this private gitlab account. I generated public and private keys through PuTTYgen and used it to communicate with above website. Here is the piece of code I ...