Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
131 views

I have a GitHub App configured with a Webhook that listens to Github events. The App is installed on a private repo and has both read and write permissions. git clone https://x-access-token:<TOKEN&...
newkid's user avatar
  • 1,488
0 votes
0 answers
134 views

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 ...
snowwolf75's user avatar
1 vote
1 answer
259 views

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 =...
Ticoincoin's user avatar
0 votes
1 answer
107 views

I am trying to check out a git branch,generate files using python code and then push the changes to the branch using GitPython library Below is the code used repo = git.Repo(...
Sachin Shetty's user avatar
0 votes
2 answers
104 views

I know you can get the head of a branch directly using it's name (e.g. repo.heads.main). Can you get the head of a branch that has illegal variable characters (e.g. feature-generate-events) directly ...
Stephen Rasku's user avatar
0 votes
0 answers
127 views

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: ...
Ame Suzuki's user avatar
0 votes
0 answers
114 views

I have the following piece of code to get the list of commit summaries of a specific file: from git import Repo repo_working_dir = '<valid directory of the repo>' repo = Repo(repo_working_dir) ...
Rajesh's user avatar
  • 1
0 votes
1 answer
772 views

I must be dense, but I haven't been able to find a solution yet. I am trying to get a list of all of the members (in all commits or not committed yet) that have changed on a branch in my Python ...
Mark Hammack's user avatar
0 votes
0 answers
157 views

I have this Python Script that clones a list of length n of repositories using ssh. import pandas as pd import time import git import sys import os counter = 0 #excel reader resources = pd....
camilomartinezrincon's user avatar
0 votes
0 answers
65 views

Using the gitpython library, I'm trying access the date of the last changes on a given file. So far I only found out how to: import git # get a handle on a repo object for the current directory repo=...
Antoine Gallix's user avatar
0 votes
1 answer
300 views

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') ...
Dmitry's user avatar
  • 1,649
1 vote
0 answers
107 views

I'm running a command with GitPython git.execute(). Currently, I'm writing the return value to a window. Because the command takes some time, the window will not show any progress for a few seconds ...
Christian's user avatar
  • 199
0 votes
1 answer
142 views

I have a PySimpleGUI with a button and a multiline. When I click on the button, a method is called and running for a couple of seconds (calls i.a. GitPython methods). The method shall write its output ...
Christian's user avatar
  • 199
0 votes
1 answer
1k views

I want to fetch all files and directories present in a git repo using Python and then parse through each directory to get details of files present under them. Below is the piece of code I have been ...
Shivani's user avatar
0 votes
1 answer
62 views

I am trying to write a basic script that is pulling replicating the contents of one directory into another one, but making some modifications along the way. The items written in the new directory are ...
Panduar's user avatar
  • 31
0 votes
0 answers
87 views

When trying to run a Python script I got the following errors: Traceback (most recent call last): File "C:\Users\{User}\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\__init__....
eRod's user avatar
  • 11
1 vote
1 answer
265 views

Our team needed to clone a private GitHub repo within an Azure Function, where you can only run Python code - but there is no access to the shell or pre-installed Git or SSH binaries. At the same ...
Dmitry Alergant's user avatar
1 vote
0 answers
647 views

I am trying to clone an Azure DevOps git repository using an Azure app registration/service principal. I was successful in bash with the help of this answer. Sadly, adapting it to GitPython results in ...
Felix Thein's user avatar
0 votes
1 answer
380 views

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 ...
Leah's user avatar
  • 29
3 votes
2 answers
4k views

I am using Python 3.10.4, GitPython version 3.1.31, mypy version 1.4.1: $ pip show GitPython Name: GitPython Version: 3.1.31 Location: /home/hakon/.pyenv/versions/3.10.4/lib/python3.10/site-packages ...
Håkon Hægland's user avatar
0 votes
1 answer
171 views

I am using the gitpython library to obtain the SHA of Python code during execution on a Windows 11 Enterprise PC. It works fine when I do it as I cloned the repo. When another user tries to run the ...
Bobby's user avatar
  • 23
0 votes
1 answer
720 views

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....
wyt's user avatar
  • 115
2 votes
0 answers
407 views

I have a project which uses Azure DevOps as version control system. I want to get total changed line of code count for every pull request in the project. To do this, I send a request to Azure DevOps ...
Sergen's user avatar
  • 21
0 votes
1 answer
175 views

Python version 3.11.3 When I use gitpython, my codes like below os.environ["PYTHONIOENCODING"] = "utf-8" os.environ["PYTHONUFT8"] = "on" repo = Repo(repo_path) ...
dino he's user avatar
0 votes
0 answers
144 views

i try to show the progress using this code in pyQt5 Widget : import sys from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QProgressBar, QVBoxLayout from PyQt5.QtCore import QObject, ...
Ahbar Abdellah's user avatar
2 votes
0 answers
96 views

I was going through git commands and I was not able to find a command that takes in MR id and gives somthing like merge request object from where I can get target branch. Is there any such git command ...
Ajinkya Dandvate's user avatar
0 votes
1 answer
101 views

I use the following python code to extract the diff (the hunks) between two commits. from git import Repo !git clone https://github.com/apache/commons-math.git repo = Repo("/content/commons-math&...
Sadegh Sh's user avatar
1 vote
0 answers
68 views

I somehow have a git submodule without a path, which I would like to remove. Looking into the submodules of my codebase, there is some weird config: [submodule "a/path"] path = a/path ...
Tom's user avatar
  • 93
3 votes
1 answer
671 views

tl;dr: I have a repository cloned but cannot see an orphaned commit locally. How can I get that commit if it did not come with the repo? Details: I am trying to get the contents of a specific file on ...
smgtkn's user avatar
  • 140
0 votes
1 answer
532 views

I am using this code snippet with GitPython to capture the current branch, most recent commit, and most recent tag. This information will be inserted into a version string. repo = git.Repo(...
Steve's user avatar
  • 1,322
1 vote
0 answers
419 views

I would like to set a progress bar when cloning a repository with GitPython, by using some library such as tqdm. For the moment I wrote the following code in the main.py: import git ...some code... ...
Admin's user avatar
  • 49
0 votes
1 answer
756 views

I'm trying to do something like repo.git.commit('-m', 'test commit', author='[email protected]') but instead of the author, I want to pass the --allow-empty to send a dummy commit to the repo. but the ...
c0d3rbox's user avatar
0 votes
1 answer
248 views

Q+A (I'm posting this in case someone else goes down this niche rabbit hole - as it took me a while to figure this out). Scenario: You've decided to run a unit-test which 'plays' with creating a local ...
shaib's user avatar
  • 26
1 vote
1 answer
657 views

I am writing a script that clones and pushes something to the repository on gitlab. The thing is I have to clone to a specific directory on the filesystem and push from the same directory the project ...
JBravo's user avatar
  • 93
2 votes
0 answers
71 views

I struggle to find how to get the list of files that have been modified on my current branch (and ONLY on my current branch, not on the other branches). For example, I have a branch my_branch based on ...
lucas_v67's user avatar
1 vote
1 answer
184 views

I am new to GitPython and I am trying to have a python program stage itself to a new git repository (my-new-repo). My main.py is as follows: import git repo = git.Repo.init('my-new-repo') # List all ...
Hitesh Arora's user avatar
1 vote
2 answers
633 views

So if I have a git config file something like this. [color "branch"] current = yellow bold local = green bold remote = cyan bold I want to read the text between in quotes. I ...
Random Dude's user avatar
0 votes
1 answer
93 views

I would like to store the following info per commit like so, for commit in repo.iter_commits(branch): author_name=commit.author.name commit_id=commit commit_authored_date=datetime.datetime....
Gargee Suresh's user avatar
1 vote
1 answer
401 views

I am using the following code using gitpython: g = git.cmd.Git(r'C:\Users\alex\Files\Repo\Scripts') g.reset('--hard') g.pull() but I get the following error: GitCommandError: Cmd('git') failed due to:...
chulo's user avatar
  • 73
0 votes
1 answer
341 views

I am trying to get all the content from each revision - history of a file in my local repo i am using gitpython lib and here is the code: import git,json from pprint import pprint repo = git.Repo() ...
rick_sorkin's user avatar
1 vote
2 answers
641 views

I need to get and make a copy of a single file in a specific commit. I'm using git show to accomplish this: >> git show 4c100bd6a48e3ae57a6d6fb698f336368605c0a2:test_file.txt >> ...
guidout's user avatar
  • 342
2 votes
2 answers
1k views

We have a locally hosted Gitlab repository which I am trying to automate pushing and pulling with gitpython over ssh with the following script: LOCAL_REPO_PATH = "/path/to/repository" repo =...
Jake Mullins's user avatar
0 votes
1 answer
247 views

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 ...
Sai ram's user avatar
3 votes
0 answers
1k views

Is there a way to this in Python? git remote add origin https://gitlab.com/xxxx/aaa/bbb/feature2.git git branch -M main git push -uf origin main Things I have tried: I tried to do from git import ...
Adam's user avatar
  • 1,315
0 votes
0 answers
1k views

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 ...
Shox2711's user avatar
  • 139
0 votes
0 answers
2k views

I've read through other solutions on here for general module x has no attribute y to no avail. What's catching me here is that this works fine on my local machine. When I transfer it over to a remote ...
Shox2711's user avatar
  • 139
0 votes
0 answers
2k views

I am trying to clone a GitLab repo in a python script using GitPython. I want it to be able to clone this private repo from GitLab without me having to manually input my username and auth token each ...
mandypea's user avatar
1 vote
0 answers
124 views

How to set git secret-key to GitPython in order to access already cloned local repo import git repo = git.Repo('local/already-cloned-repo-path') repo.remotes.origin.pull() Consider the case where git ...
Sunil Rao's user avatar
  • 850
0 votes
1 answer
1k views

I have a git repository on an internal server and now want to have a scheduled task that automatically pulls changes to my local version. Found the GitPython package, which seems to be exactly what I ...
s6hebern's user avatar
  • 795
0 votes
1 answer
183 views

I want to save a certain version of the excel file using python I have used git show to get the content of this excel git show 17ed4f74:xxx.xlsx output: how to save it as an .xlsx file
Veasky's user avatar
  • 45

1
2 3 4 5
11