All Questions
27 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 ...
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: ...
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') ...
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
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 ...
0
votes
0
answers
1k
views
How to get time of last commit date for Git repository files via Python?
I'm trying to get the latest commit date for each file in a specific folder in a repo.
My code:
import git
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
repo = git.Repo(dir_path)
...
0
votes
0
answers
153
views
Returning all repos under a given root path using GitPython
If I provide a root path such as ("C:/ProgramFiles") to the function,
the code should give a list, where each element is the
(local path of this repo found under the root path, remote URL, ...
1
vote
2
answers
2k
views
How to use python to check whether there are unstaged/uncommitted change or unpushed commit in a git repo
How to use python to check whether there are unstaged/uncommitted change or unpushed commit in a git repo?
I only know the command line
git status would tell
unstaged change
uncommitted stage
also ...
1
vote
1
answer
170
views
Identify the commits that were made in the last push
Is there a way to determine which commits that were pushed during the last push event using the GitPython library?
The only thing I've found is the ability to search for a commits made during some ...
2
votes
1
answer
357
views
Extract paths to modified files except for deleted or renamed files
I need to get the paths to the files that were changed in the last commit using GitPython.
I managed to do it this way:
import os
from git import Repo
repo = Repo(os.path.dirname(sys.argv[0]))
commit ...
1
vote
1
answer
2k
views
getting difference of commits between two branches using gitpython
What I want to achieve can be done using command line git as follows
git log stage..develop
commit ea31b4f01f02af91f31.....b34895e1c825 (origin/develop, develop)
Author: author <[email protected]&...
1
vote
0
answers
549
views
Commit file changes using Python
I want to overwrite a text file using Python and commit each iteration into a Git repo, so that I can analyze the file, seeing something like this for each commit:
-Number1
+Number2
I had the idea of ...
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 ...
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
1
answer
1k
views
gitpython to prune local branches
I am trying to achieve git remote prune origin through gitpython. I am able to get the branches to delete by using Repo(path).remote('origin').stale_refs.
Any idea how can I prune these?