All Questions
34 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 =...
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 ...
1
vote
1
answer
364
views
Download files temporarily from a git repo - leaves orphaned git process
I want to get the contents of a git repo into a temporary directory so I can copy the files I need elsewhere and then delete the rest. I've done this:
import git
import contextlib
import tempfile
@...
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
0
answers
289
views
How to make gitpython ask for authentication credentials every time?
I use gitpython for cloning, pulling, committing, and pushing repo.
While cloning, it asks for a username, and password and stored inside .git/configs.
So every time, a user makes a commit and push it ...
0
votes
0
answers
140
views
On Windows 10 (using cygwin running python GitPython), how to do a git pull?
With this Python code (using GitPython) (passing 'sqa' as branch):
def git_pull(self, branch_name):
self.repo.git.checkout(branch_name)
branch = self.repo.active_branch
...
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 ...
0
votes
1
answer
729
views
Clone repository and "checkout" to "tags/<my_tag>
I clone a repository using Repo.clone_from(). Afterwards, I simply want to switch to a specified tag within the repository, similar to git checkout tags/<my_tag>.
I found the following solution, ...
0
votes
1
answer
1k
views
Looking to use GitPython to clone a repostiory in Lambda
I'm looking for a way to use Git and Lambda together to help manage our AWS users, this is what I would like to achieve...
End user creates a PR with a new/updated IAM policy document for the ...
4
votes
2
answers
10k
views
How to get the latest commit hash on remote using gitpython?
Is there a way that I can get the most recent commit on a remote repository using gitpython?
I do not want to perform operations like a pull or merge on my local branch. I also do not want to depend ...