Git - Credential
Table of Contents
About
Git makes use of a credential helper (an external utility) to be able to retrieve the credentials)
The id of a credential (user, ww) is a URL (Credential context)
It will lookup a credential with the user, protocol, host. By order of precedence, Git will search the following credential URL to find a credential
- first, git:http://[email protected]:port
- if not found then, git:http://hostname:port
Management
Helper
Get
Which credential helper use git now ?
git config --global credential.helper
manager
List
git help -a | grep credential-
credential-manager merge-recursive submodule--helper
credential-store merge-resolve subtree
credential-wincred merge-subtree svn
Help
First, list them, then you can ask the help for one of them with the below command.
Example for credential-store
git help credential-store
Config
git config --global credential.helper foo
#where foo is your credential helper
Example:
- for Git Credential Windows Manager
git config --global credential.helper manager
- for Git Credential Store (File System)
git config --global credential.helper store
Credentials
Set
- In a url, it works only for ssh or https:
git clone https://username:[email protected]/username/repository.git
- Setting the username
git config --global credential.helper cache
git config credential.https://hostname.username myusername