Try git-credential-manager

Last updated on 2022-03-16, Wed, 03:19 PM


How I Found This

I am a user of several git platforms and hold more than one identity on one of them.

SSH is out of the question and will never be used in my lifetime.

So for me, credential management is a big problem: using shipped plaintext credential store is obviously too dangerous, but I don’t want to have to enter the password every time.

Then I happened to see a glimmer of hope in the comments section of Haruhi’s sometime tweet.

git-credential-manager is exactly what I want.


Please refer this .


For gitea, it is recommended to specify the authentication source as generic beforehand.

[credential ""]
	provider = generic


Use DPAPI to encrypt credentials. [1]

	helper = C:/Program\\ Files\\ \\(x86\\)/Git\\ Credential\\ Manager/git-credential-manager-core.exe
	credentialStore = dpapi

If you don’t need to use it globally, please restore the credential.helper properties in your home directory to avoid any inconvenience.


Use GPG / pass for encryption. [2]

API by frequently fails to communicate with gcm and will lose your credentials.

It is recommended to generate a separate key for encryption.

gpg --expert --full-gen-key

Initialize pass. Don’t contain spaces when entering Key ID.

Edit .gitconfig.

	helper = /usr/local/bin/git-credential-manager-core
	credentialStore = gpg


Add username in front of the hostname in the remote url. [3]

Like this:

git clone

Limit the effective range of .gitconfig

Here you need to use git’s conditional includes feature.

Find the .gitconfig file in your $HOME / %HOME% directory and add

[includeIf "gitdir:/path/to/customize/"]
	path = /path/to/your/config

Adding / at the end is equivalent to a wildcard to /** , which will work for all subdirectories below.

The prefix ~/ is relative to the home directory, while ./ is relative to the directory this .gitconfig is located in.

Also, you can nest multiple .gitconfig files.

For duplicate configurations, the closer the file is to .git/config in the actual git repository, the higher its priority.

In this way, you can restrict your credential store settings to certain directories.

Done, once and for all.


Try git-credential-manager
Posted on
2022-03-04, Fri, 12:19 AM
Updated on
2022-03-16, Wed, 03:19 PM
Licensed under