All Questions
Tagged with gitpython python-3.x
58 questions
0
votes
0
answers
97
views
GitPython unable to execute command in existing repository
I am trying to run a script with GitPython, but it seems to only fail when I run from inside the Jenkins automation environment. The error that it gives isn't very helpful (and I haven't been able to ...
1
vote
1
answer
159
views
Add safe directory with gitpython
How do I run this git command with gitpython(v2.1.*), please ?
git config --global --add safe.directory "some_dir"
Couldn't find in doc.
I tried this:
repo = git.Repo.init(some_dir)
config =...
5
votes
2
answers
7k
views
How to install gitpython with, Failed to initialize: Bad git executable
I am trying to install git-python on Windows. I tried to install it using the git command:
pip install gitpython
It installed just fine and it install in my local app data. The only problem was is ...
0
votes
0
answers
109
views
Trouble pushing to Git remote using GitPython: "remote unpack failed" and "RPC failed; HTTP 500"
I'm encountering issues when trying to push changes to a Git remote repository using GitPython. I'm receiving two different errors intermittently, and I'm unsure how to resolve them.
Error 1
error: ...
7
votes
5
answers
28k
views
How to download single file from a git repository using python
I want to download single file from my git repository using python.
Currently I am using gitpython lib. Git clone is working fine with below code but I don't want to download entire directory.
...
0
votes
1
answer
195
views
How to call rev_list with GitPython
This program fails
import git
repo = git.repo.Repo('..')
res = repo.git.rev_list('--since="2024-01-01" master').split('\n')
with the following error
git.exc.GitCommandError: Cmd('git') ...
6
votes
2
answers
3k
views
How to get master/main branch from gitpython
How one can know about the master/main branch at git remote with git-python.
I am aware that we can iterate over the heads of the repository and then check the results. Something like
repo = git.Repo('...
0
votes
1
answer
327
views
GitPython: get rename files as deleted and added
I need to get git diff files since specific commit using GitPython. As I understood I get renamed files using 'R' type . Is it possible to get the rename_from in the deleted lists and the rename_to in ...
0
votes
1
answer
637
views
Mocking GitPython Repo Calls
I've got a class with a function that adds unstaged changes in a git repo and commits them
def commit_local_changes(self, repo_path):
repo = Repo(repo_path)
changed_files = repo....
2
votes
2
answers
794
views
difference in returned FetchInfo object from gitPython when there is something to fetch/pull vs when there isn't?
I'm trying to assess whether there have been changes in a remote repository that I may need to pull before a certain piece of code.
I do that by fetching a FetchInfo object via fetch() to a remote ...
1
vote
2
answers
1k
views
pushing zipped files on github using python
i want to push a .zip file on github using python code or API, but in doing so with some resources which i found on stackoverflow, the file is being pushed but the data pushed is corrupted and cannot ...
0
votes
1
answer
242
views
How to execute --track, using GitPython(as a python script). "git checkout -B <branchname> --track origin/<TeamBranch>"
I can execute "git checkout -B --track origin/TeamBranch" through terminal. but I have the requirement to implement the above command through my script using Gitpython.
can someone help me ...
1
vote
2
answers
1k
views
how to use "--no-ff --no-commit" using GitPython while merging?
When i use commandline git merge with --no-ff --no-commit works fine. But using GitPython i am unable to dos.
May be i am not finding a correct documentation or forums for the below equivalent ...
0
votes
0
answers
1k
views
module 'git' has no attribute 'Repo' - when running as non-root user.. works as root user
As above, I wrote a gitlab pre-receive hook that runs as a 'git' user on our gitlab server. When testing it, I get the above error. However when I SSH into the server and manually run the script as ...
1
vote
0
answers
311
views
Get file commit time in GitPython
How we can get the commit time of file (blob) via Gitpython while traversing the tree?
I need to get commit time of each FILE (not directory) in the full repo/tree. Something as we get via command git ...