Registry / auth-security / git-credentials

git-credentials

JSON →
library1.0.0pypypi✓ verified 86d ago

Simple library to interact with Git Credentials. Version 1.0.0 enables reading, storing, and erasing credentials via the Git credential helper protocol. Low release cadence.

pip install git-credentials
INSTALL
IMPORT
SIG · GIT-CREDENTIALS
G
git-credentials
auth-securitypythonv1.0.0
Install
1.5s avg
Import
36ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.040s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.032s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GitCredentials
from git_credentials import GitCredentials
Correct import path uses underscore in module name.

Basic usage: create a GitCredentials object, set username/password, approve, fill, or erase.

from git_credentials import GitCredentials cred = GitCredentials(url='https://example.com') # Fill in credentials (typically after a prompt) cred.username = 'user' cred.password = 'pass' # Approve credentials (send to git credential approve) cred.approve() # To fetch credentials stored = cred.fill() print(stored.username, stored.password) # Erase credentials cred.erase()
Debug
Known issues
gotchaGitCredentials constructor requires exactly one of url, path, or host. Missing required argument raises TypeError.
fix
Always pass at least url, path, or host keyword argument.
affects: all
gotchaCredentials are stored in plaintext by Git; the library does no encryption. Do not store sensitive passwords in shared repositories.
fix
Use environment variables or a vault for secrets.
affects: all
Errors
Common errors & fixes
AttributeError: 'GitCredentials' object has no attribute 'approve'
Calling approve() without setting username and password (or the object is incomplete).
fix
Ensure you set both username and password before calling approve().
git: 'credential' is not a git command.
Git version < 2.6.0 does not support credential helper protocol.
fix
Upgrade git to version 2.6.0 or later.
Upgrade
Version history
1.0.0latest on PyPI · released Jan 31, 2022
Audit
Dependencies
gitrequiredRequires git executable in PATH
Agent activity
22 hits · last 30 days
node
22
Resources
git-credentials — pip install git-credentials · libregistry