gitdb2 is a 'mirror package' that provides the `gitdb` library, which implements a pure-Python object database for Git. It handles the storage and retrieval of Git objects (blobs, trees, commits, tags) and is a core dependency for libraries like `GitPython`. The current version is 4.0.12, with releases driven primarily by `GitPython`'s needs and Python version compatibility.
pip install gitdb2Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `GitDB` instance, store a 'blob' object, and then retrieve it using its SHA1 hash. It utilizes `tempfile` for creating a temporary database location.
Always use `import gitdb` or `from gitdb import ClassName` for all functionality.
Ensure your project's Python interpreter version matches the requirements of the `gitdb2` version you are using. Upgrade `gitdb2` to the latest version for Python 3.8+.
If you need Git functionality, consider using `GitPython` which builds upon `gitdb` and provides a higher-level API. Only use `gitdb` directly if you require low-level Git object database interaction.
Use a virtual environment to isolate dependencies. If conflicts persist, check the dependency tree of your project for other libraries requiring `smmap` and try to align their versions, or consider alternative solutions.
Ensure compatible versions of GitPython and gitdb/gitdb2 are installed. For older setups experiencing this, explicitly pin `gitdb2` and `gitdb` to known compatible versions, such as `pip install --upgrade gitdb2==2.0.6 gitdb==0.6.4`, or ensure your GitPython is up-to-date to a version that handles newer gitdb structures.
Ensure `gitdb2` (which provides `gitdb`) is correctly installed. If issues persist, try uninstalling both `gitdb` and `gitdb2` and then reinstalling `gitdb2` (e.g., `pip uninstall gitdb gitdb2 && pip install gitdb2`). If a downstream dependency like `GitPython` is involved, ensure it's also updated or reinstalled to pull the correct `gitdb` dependency.
Upgrade your Python environment to version 3.4 or higher to meet gitdb2's compatibility requirements.
First, verify the integrity of your Git repository using `git fsck`. If the repository is sound, ensure that your Git executable is correctly installed and accessible in the system's PATH. Finally, confirm that GitPython and gitdb2 are updated to their latest compatible versions to rule out software bugs.