git-credential-keepassxc
git-credential-keepassxc is a Git credential helper that allows Git to get/store logins from/to KeePassXC.
It communicates with KeePassXC using keepassxc-protocol which is originally designed for browser extensions.
How to install
- Install Rust compiler via rustup or your favourite package manager
- Run
cargo install git-credential-keepassxc(orcargo install --git https://github.com/Frederick888/git-credential-keepassxc.gitfor the latest development version)
Note: Make sure $CARGO_INSTALL_ROOT is in your search path.
Configuration
Similar as the browser extensions, git-credential-keepassxc needs to be associated with KeePassXC first.
Run:
A group (by default Git) will be created to store new logins.
Limit callers
git-credential-keepassxc allows you to limit callers (though you should probably have a look at some MAC systems to properly achieve this), for instance:
# don't forget to add yourself first
# then allow Git to access KeePassXC when sending emails via SMTP
# also add other Git executables if you want to e.g. clone via HTTPS
|
# disable this function
Tip
Although currently it's not possible to return entries only from the Git group, you may still want to hide specific ones from Git (for instance GitLab allows only access tokens to clone over HTTPS when 2FA is enabled, so your password may conflict with the token). This can be done by adding a magic attribute to those entries.
- In KeePassXC, go to Tools -> Settings -> Browser Integration -> Advanced, enable 'Return advanced string fields which start with "KPH: "' (this is enabled by default)
- Open the entry you'd like to hide
- Go to Advanced
- Add an additional attribute "KPH: git" (without quotes, the space after colon is necessary) of which the value is "false" (without quotes)