class pygit2.Settings

Library-wide settings interface.


Set the maximum total data size that will be cached in memory across all repositories before libgit2 starts evicting objects from the cache. This is a soft limit, in that the library might briefly exceed it, but will start aggressively evicting objects from cache when that happens. The default cache size is 256MB.

cache_object_limit(object_type, value)

Set the maximum data size for the given type of object to be considered eligible for caching in memory. Setting to value to zero means that that type of object will not be cached. Defaults to 0 for GIT_OBJECT_BLOB (i.e. won’t cache blobs) and 4k for GIT_OBJECT_COMMIT, GIT_OBJECT_TREE, and GIT_OBJECT_TAG.

property cached_memory

Get the current bytes in cache and the maximum that would be allowed in the cache.


This will cause .keep file existence checks to be skipped when accessing packfiles, which can help performance with remote filesystems.


Enable or disable caching completely.

Because caches are repository-specific, disabling the cache cannot immediately clear all cached objects, but each cache will be cleared on the next attempt to update anything in it.

property mwindow_mapped_limit

Get or set the maximum memory that will be mapped in total by the library

property mwindow_size

Get or set the maximum mmap window size

property search_path

Configuration file search path.

This behaves like an array whose indices correspond to the GIT_CONFIG_LEVEL_* values. The local search path cannot be changed.

set_ssl_cert_locations(cert_file, cert_dir)

Set the SSL certificate-authority locations.

  • cert_file is the location of a file containing several certificates concatenated together.

  • cert_dir is the location of a directory holding several certificates, one per file.

Either parameter may be NULL, but not both.

property ssl_cert_dir

TLS certificates lookup directory path.

property ssl_cert_file

TLS certificate file path.