🌐
GitHub
https://github.com › gitpython-developers › gitpython
GitHub - gitpython-developers/GitPython: GitPython is a python library used to interact with Git repositories. · GitHub
3 weeks ago - GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
🌐
Readthedocs
https://gitpython.readthedocs.io
GitPython Documentation — GitPython 3.2.1 documentation
git.Repo · Trees & Blobs · Usage · More Resources · GitPython Tutorial · Meet the Repo type · Examining References · Modifying References · Understanding Objects · The Commit object · The Tree object · The Index Object · Handling Remotes · Submodule Handling ·
Discussions

Python Git Module experiences? - Stack Overflow
What are people's experiences with ... for Python? (I know of GitPython, PyGit, and Dulwich - feel free to mention others if you know of them.) I am writing a program which will have to interact (add, delete, commit) with a Git repository, but have no experience with Git, so one of the things I'm looking for is ease of use/understanding with regards to Git. The other things I'm primarily interested in are maturity and completeness of the library, a reasonable ... More on stackoverflow.com
🌐 stackoverflow.com
Automatically increment version on package release?

However you end up triggering it, I recommend you use bumpversion to actually do the bumping.

More on reddit.com
🌐 r/Python
7
1
February 24, 2016
Python library for pulling remote git metadata without cloning the repo locally?
I have used python-gitlab for this. That was obviously for gitlab but for whatever repo host you're using you can check if their is a package. Or they will usually at least have an api you can use to get this info More on reddit.com
🌐 r/git
9
2
July 12, 2020
aiowmi - A Python WMI library
What are the differences to the decades old WMI module by Tim Golden? http://timgolden.me.uk/python/wmi/contents.html More on reddit.com
🌐 r/Python
3
11
March 11, 2022
🌐
PyPI
https://pypi.org › project › GitPython
GitPython · PyPI
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
🌐
Readthedocs
https://gitpython.readthedocs.io › en › stable › intro.html
Overview / Install — GitPython 3.2.1 documentation
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
🌐
Blue Book
https://lyz-code.github.io › blue-book › coding › python › gitpython
GitPython - The Blue Book
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
🌐
Fonzi AI
https://fonzi.ai › blog › gitpython
GitPython Guide: How to Use Python's Git Library | Fonzi AI
April 10, 2026 - GitPython is a Python library for interacting with Git repositories programmatically, allowing you to clone, pull, push, inspect commits and tags, create branches, manage objects, and query low-level structures like blobs and trees directly ...
🌐
Readthedocs
https://gitpython.readthedocs.io › en › stable › tutorial.html
GitPython Tutorial — GitPython 3.2.1 documentation
All code presented here originated from test_docs.py to assure correctness. Knowing this should also allow you to more easily run the code for your own testing purposes. All you need is a developer installation of git-python.
🌐
Anaconda.org
https://anaconda.org › anaconda › gitpython
gitpython - anaconda | Anaconda.org
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
Find elsewhere
🌐
PyPI
https://pypi.org › project › python-git
python-git · PyPI
Activate python environment on command line. ... In case things change (perhaps you moved folders around or you add a new git repo) and you want to reset your folders just redo the initialization step
🌐
GitHub
https://github.com › jelmer › dulwich
GitHub - jelmer/dulwich: Pure-Python Git implementation · GitHub
Dulwich aims to provide full wire-format and repository format compatibility with C Git, while maintaining a pure Python implementation that doesn't depend on git being installed.
🌐
Grimoire
https://grimoire.carcano.ch › the grimoire of a modern linux professional › blog › dev-ops tools › scripting › git with python howto gitpython tutorial and pygit2 tutorial
Git With Python HowTo GitPython Tutorial And PyGit2 Tutorial
June 27, 2026 - It is a set of Python bindings to the libgit2 linkable C Git library - libgit2 is a dependency-free implementation of Git, with a focus on having a nice API for use within other programs.
🌐
GitHub
https://github.com › libgit2 › pygit2
GitHub - libgit2/pygit2: Python bindings for libgit2 · GitHub
Bindings to the libgit2 shared library, implements Git plumbing. Supports Python 3.11 to 3.14 and PyPy3 7.3+
🌐
Read the Docs
https://app.readthedocs.org › projects › gitpython › downloads › pdf › stable pdf
GitPython Documentation Release 3.2.1 Michael Trier Oct 14, 2026
September 30, 2026 - GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-
🌐
Dulwich
https://dulwich.io
Dulwich
A pure-Python implementation of the Git file formats and protocols.
🌐
Pygit2
https://pygit2.org
pygit2 - libgit2 bindings in Python — pygit2 1.20.1 documentation
Bindings to the libgit2 shared library, implements Git plumbing. Supports Python 3.11 to 3.14 and PyPy3 7.3+
🌐
LinuxConfig
https://linuxconfig.org › home › how to manage git repositories with python
Manage Git Repositories with Python: GitPython Guide
May 27, 2022 - The GitPython library can be installed either by using our favorite distribution package manager or by using pip, the Python package manager.
Starred by 727 users
Forked by 89 users
Languages: Python 99.1% | Makefile 0.9%
🌐
CodeRivers
https://coderivers.org › blog › python-git-library
Python Git Library: A Comprehensive Guide - CodeRivers
February 22, 2026 - The Python Git library, often referred to as GitPython, is a wrapper around the Git command-line tool. It allows you to perform various Git operations using Python code instead of typing commands in the terminal. It provides an object-oriented interface that maps Git concepts such as repositories, ...
Top answer
1 of 11
136

While this question was asked a while ago and I don't know the state of the libraries at that point, it is worth mentioning for searchers that GitPython does a good job of abstracting the command line tools so that you don't need to use subprocess. There are some useful built in abstractions that you can use, but for everything else you can do things like:

Use with AIimport git
repo = git.Repo( '/home/me/repodir' )
print repo.git.status()
# checkout and track a remote branch
print repo.git.checkout( 'origin/somebranch', b='somebranch' )
# add a file
print repo.git.add( 'somefile' )
# commit
print repo.git.commit( m='my commit message' )
# now we are one commit ahead
print repo.git.status()

Everything else in GitPython just makes it easier to navigate. I'm fairly well satisfied with this library and appreciate that it is a wrapper on the underlying git tools.

UPDATE: I've switched to using the sh module for not just git but most commandline utilities I need in python. To replicate the above I would do this instead:

Use with AIimport sh
git = sh.git.bake(_cwd='/home/me/repodir')
print git.status()
# checkout and track a remote branch
print git.checkout('-b', 'somebranch')
# add a file
print git.add('somefile')
# commit
print git.commit(m='my commit message')
# now we are one commit ahead
print git.status()
2 of 11
87

I thought I would answer my own question, since I'm taking a different path than suggested in the answers. Nonetheless, thanks to those who answered.

First, a brief synopsis of my experiences with GitPython, PyGit, and Dulwich:

  • GitPython: After downloading, I got this imported and the appropriate object initialized. However, trying to do what was suggested in the tutorial led to errors. Lacking more documentation, I turned elsewhere.
  • PyGit: This would not even import, and I could find no documentation.
  • Dulwich: Seems to be the most promising (at least for what I wanted and saw). I made some progress with it, more than with GitPython, since its egg comes with Python source. However, after a while, I decided it may just be easier to try what I did.

Also, StGit looks interesting, but I would need the functionality extracted into a separate module and do not want wait for that to happen right now.

In (much) less time than I spent trying to get the three modules above working, I managed to get git commands working via the subprocess module, e.g.

Use with AIdef gitAdd(fileName, repoDir):
    cmd = ['git', 'add', fileName]
    p = subprocess.Popen(cmd, cwd=repoDir)
    p.wait()

gitAdd('exampleFile.txt', '/usr/local/example_git_repo_dir')

This isn't fully incorporated into my program yet, but I'm not anticipating a problem, except maybe speed (since I'll be processing hundreds or even thousands of files at times).

Maybe I just didn't have the patience to get things going with Dulwich or GitPython. That said, I'm hopeful the modules will get more development and be more useful soon.

🌐
Waylon Walker
https://waylonwalker.com › python-git
Using Git from Python | Waylon Walker
April 30, 2022 - GitPython is a python library hosted on pypi that we will want to install into our virtual environments using pip.