Questions tagged [pygit2]

Pygit2 is a set of Python bindings to the libgit2 shared library.

Pygit2 is a set of Python bindings to the libgit2 shared library, libgit2 implements the core of Git. Pygit2 works with Python 2.6, 2.7, 3.1, 3.2 and 3.3

Pygit2 links:

82 questions
0
votes
0 answers

Most reliable way to get the repo name?

I'm not seeing anything in the docs for how to just get the repo name: https://www.pygit2.org/repository.html Is reading the origin remote and parsing it out the only way pygit supports this or is there a more reliable or specific property for…
red888
  • 27,709
  • 55
  • 204
  • 392
0
votes
1 answer

pygit2 raises KeyError: 'the requested type does not match the type in the ODB'

I'm working on porting some python2 code to python3 - single codebase. I'm using pygit2 0.28.2 on cpython 2.7, and pygit2 1.9.2 on cpython3.10, at least for now. I'm getting an error (-3) back from: err = C.git_remote_push(self._remote, refspecs,…
dstromberg
  • 6,954
  • 1
  • 26
  • 27
0
votes
0 answers

pygit2 merge simulating -Xtheirs or -Xours

I'm automating changing files in github using pygit2. Sometimes the files have changed in github while I am processing a repo so I want to pull() before I push(). Since this is automated I would like to avoid conflicts by either having my local…
0
votes
1 answer

How can I check if a given file is present in a Github repository using PyGithub?

file path = repo_name/abc/xyz.yml repo (is the git repo object) I want to be able to check if the repo consists of the file by returning a Boolean. something like: def fileInRepo(repo, filePath): if filePath in repo.files: return true …
0
votes
2 answers

How to clone master and checkout another branch in pygit2 without detached HEAD

This works fine for me using pygit2: Clone master branch of a repo Create a branch Make some changes Push branch to origin This is failing for me: Clone master branch of a repo Checkout an existing branch I always end up with detached HEAD. Is…
0
votes
1 answer

AttributeError: '_pygit2.Reference' object has no attribute 'get_object'

I'm trying to automate the task of creating and cloning a repository in my remote, when I run the following code, it seems that the method I'm trying to use may have been deprecated. What is the alternative method? from github import…
ScottyBlades
  • 12,189
  • 5
  • 77
  • 85
0
votes
1 answer

Pygit2 0.25.0 repository finding problem in windows XP

I'm writing python program to work with git repositories, it works right on win7, but I'm also need this program to work on win xp (win xp supports python 3.4, pygit2 0.28 wont work on win xp (dll import errors) so I'm installed pygit2 0.25.0) I'm…
Karmen
  • 1
  • 2
0
votes
1 answer

Salt master not able to connect to gitfs remote

I am trying to configure remote github repo as the salt server root but it can't make the authentication successful with the pub/priv keypair. I have given the location of the keys in the /etc/salt/master file as well. Below are the logs I am…
Manish Batra
  • 102
  • 6
0
votes
1 answer

Installing libgit2 and pygit2 in archlinux docker

Trying to install libgit2 and pygit2 in docker. Keep running into errors no matter how I try. Current docker file: https://pastebin.com/jsbdqeEX Current error: https://pastebin.com/MVHXUuxa Thank you for any help you can provide
0
votes
1 answer

get all repo commits using pygit2 with svn repos

Now i'm using git svn for cloning repos, when i want to get all their commits and store whem to the db. For getting all the commits i use pygit2.Repository but i see that i receive only commits from '/trunk/' branch. If i use git branch -a in…
Vova
  • 580
  • 3
  • 7
  • 20
0
votes
2 answers

Get path of the current repo in PyGit2 from anywhere within the repo

I'm using Pygit2 to run certain operations within the repo I'm working on. If my code file is not at the root of the repo, how can I get the path of the repo from anywhere within the repo? I can do the below in case the function is called from root,…
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
0
votes
1 answer

Cloning only the main branch using PyGit2

I want to clone some remote repositories, but only retrieving the main branch. My code currently gets all of the branches. def init_remote(repo, name, url): # Create the remote with a mirroring url remote = repo.remotes.create(name, url,…
George L
  • 1,673
  • 2
  • 26
  • 39
0
votes
1 answer

Redhat 7.0 Pygit2 install error

I am tried to install pygit2 python library with pip on Redhat 7.0 but i got the following error. If anybody have an idea how to solve this problem please let me know. I would really appraciate any idea. This is the console output after pip install…
eszik.k
  • 1,729
  • 4
  • 17
  • 40
0
votes
1 answer

An error in signature when pushing using pygi2

I'm facing problem when pushing using pygit2 v0.21.3 . here is my code : import pygit2 as git repo = git.Repository("path/to/my/repo.git") # just for testing,it will not be local for rem in repo.remotes: rem.push_url = rem.url …
Ahmed T. Ali
  • 1,021
  • 1
  • 13
  • 22
0
votes
1 answer

delete a reference in pygit2

I am using the library pygit2 to implement a git module on my project. Right now i'm blocked by these 2 scenarios : - the deletion of a tag than a push - the deletion of a branch than a push this is what i'm trying to do : >>> branch =…
mohamed wael thabet
  • 195
  • 2
  • 4
  • 12