pypi / gitpython
gitpython
What changed in gitpython 3, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
8 breaking40 security6 new APIs and options1 performance4 behavior and defaults1 tooling47 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initgitpython 3107 changes
Breaking changes 8
Python 3.7 is no longer supported.
Filesystem diffs now require explicit opt-in.
File-reading Git options are blocked.
Cloning blocks separate Git directories.
Unsafe Git file and URL options are blocked.
Clone URLs are preserved literally instead of being expanded with os.path.expandvars(), preventing environment-variable exfiltration.
Guards unsafe Git command options and rejects their abbreviated forms.
Blocks unsafe underscored Git keyword arguments.
Security 40
Symbolic links that alias .gitmodules are rejected.
GitPython validates a submodule's ".git" path only after cloning into it (RCE)
URL credentials are redacted without corrupting the host.
Actor and date parsing is bounded.
Safety checks in Git command wrappers are completed.
GitPython: arbitrary file read via attacker-controlled branch name in
Head.checkout()(incomplete fix of CVE-2026-78679)GitPython Remote.pull() refspec bypasses the --upload-pack unsafe-option guard, enabling arbitrary command execution
GitPython: separate_git_dir leaks env vars via crafted .gitmodules submodule name
Submodule move destinations through intermediate symlinks are rejected.
Unsafe submodule checkout paths are rejected.
Diff path parsing is hardened.
GitPython: Denial of Service via catastrophic backtracking (ReDoS) in Actor.name_email_regex — commit author/committer field parsing
GitPython: --no-index bypasses diff unsafe-option protections and enables a blind local-file content oracle
GitPython: Repository content can impersonate the git directory, leading to arbitrary code execution
Configuration parsing boundaries are hardened.
GitPython: Arbitrary local file content disclosure via [include] directive in untrusted .gitmodules (SubmoduleConfigParser never disables merge_includes)
GitPython: Dormant multi-line git-config values are corrupted into live injected directives (e.g. core.hooksPath) on any unrelated GitConfigParser write, enabling RCE
GitPython: Incomplete unsafe_git_revision_options denylist omits --contents/-S, enabling arbitrary file read via Repo.blame()
GitPython: TagReference.create positional reference bypasses kwargs-only --file guard, enabling arbitrary file read (incomplete fix of 3af0c251)
Hardens validation of configuration and Git options.
GitPython: Arbitrary file read via --pathspec-from-file in IndexFile.remove() and Head.checkout()
GitPython: Arbitrary Git Repository Creation Outside the Working Tree via Unvalidated .gitmodules Submodule Name in GitPython
GitPython: git-config OPTION-name injection via =/#/whitespace bypasses name validator, enabling forged core.sshCommand/hooksPath (RCE)
GitPython: Unguarded git option forwarding in Repo.init enables arbitrary command execution via --template clone hooks
GitPython: Unguarded git read-tree option forwarding in IndexFile.from_tree/reset/merge_tree enables arbitrary file overwrite
GitPython: Unsafe git option guard bypass via split_single_char_options=False short-option token smuggling enables command execution
Authorization extra headers are redacted from command errors.
GitPython: Incomplete unsafe_git_archive_options denylist omits --add-file / --add-virtual-file, enabling arbitrary file read via Repo.archive()
GitPython: Arbitrary file truncation via git rev-list --output argument injection in unguarded Commit.count
Prevents environment expansion in remote URLs.
GitPython: Arbitrary file overwrite via git diff --output argument injection in Diffable.diff (key- and value-controlled)
GitPython: Incomplete unsafe_git_clone_options denylist omits --template enabling arbitrary command execution via clone hooks
Validation of unsafe Git options was hardened.
Validates config section delimiters.
GitPython: command injection via unguarded Git options in
Repo.archive(),git.ls_remote(), and arbitrary file overwrite viaRepo.iter_commits()/Repo.blame()GitPython unsafe clone option gate bypass through joined short options
GitPython: Newline injection in config_writer() section parameter bypasses CVE-2026-42215 patch, enabling RCE via core.hooksPath
Control characters are rejected in values written to configuration.
GitPython reference APIs has a path traversal vulnerability that allows arbitrary file write and delete outside the repository
GitPython: Unsafe option check validates multi_options before shlex.split transformation
New APIs and options 6
Submodule updates can be performed without fetching.
Adds a deinit method to Submodule.
Adds a property to determine whether a commit is shallow.
Adds support for trailers when creating commits.
Adds support for the hasconfig Git rule.
Adds preliminary support for index format v3.
Performance 1
Accumulating gpgsig continuation lines now takes linear time.
Behavior and default changes 4
get_value reads Git's yes/no and on/off boolean values.
Worktrees created from bare repositories are kept non-bare.
Allows relative configuration paths to be used with includes.
Supports relative worktree paths when Git's worktree.useRelativePaths setting is enabled.
Tooling 1
The return typing for RemoteProgress.parse is improved.
Fixes and other changes 47
Byte modes are decoded before their digits are read.
Accepts a single PathLike in checkout.
Identity fields that alter commit headers are rejected.
Exact large integer values are preserved.
Whitespace in filenames is preserved in stats.
Each stdin record contains one object name or path.
Names are resolved independently of list attributes.
Lock files are created in one exclusive step.
Stalled remote commands are stopped when their timeout expires.
Destinations are validated before mutation.
Object types are validated when loading binary SHAs.
Checkout positional reference options are validated.
co_authors trailer parsing is bounded.
High-level Git commands preserve positional operands.
Git config name matching is case-insensitive.
Implicit boolean config keys are preserved, and comments after them are rejected.
Inline config comments are stripped the way Git does.
Option-line parsing is bounded.
Literal separate Git directory paths are preserved.
Timeout child-process lookup works on non-GNU systems.
A UTF-8 BOM is skipped when reading config files.
Backslash line continuations are joined when reading config values.
The accidentally removed regex was restored and deprecated.
Wait for the git daemon to listen before connecting.
Repository discovery precedence was fixed.
Git config escape semantics are preserved.
The method now respects worktree filters when adding files.
Corrects how Bash precedence is handled for Windows hooks.
Fixes Windows path handling on Python 3.13 and later.
The timeout is honored when output streams are used.
Parsed patch diffs use standard prefixes.
Adds support for Python 3.15.
Commit hooks now respect core.hooksPath.
Makes submodule.update() work after submodule.deinit().
Index diffs can now be created against the empty tree.
Config key names are validated before writing.
Fixes Repo autodiscovery in linked worktrees when GIT_DIR is set.
Pure Python rev-parse coverage and behavior are improved.
Guard termination during interpreter shutdown.
Fixes the behavior of
with_stdout=False.GitConfigParser no longer ignores multiple [include] path entries.
Checks multi-options after splitting them with
shlex.Fixes active branch resolution for reftable-backed repositories.
Respects os.Pathlike objects.
Allows joining a Pathlike object to a Tree.
Uses the actual return type in the method annotation.
Corrects the type hint for the reference property.