The repository

Everything starts either by creating a new repository, or by opening an existing one.

The Repository class

class pygit2.Repository(path)

The Repository constructor only takes one argument, the path of the repository to open.

Example:

>>> from pygit2 import Repository
>>> repo = Repository('pygit2/.git')

The API of the Repository class is quite large. Since this documentation is organized by features, the related bits are explained in the related chapters, for instance the pygit2.Repository.checkout() method is explained in the Checkout section.

Below there are some general attributes and methods: