Reads cached credentials using the configured Git credential helper.
(MIT license)
go install github.com/VonC/git-cred@latest A git credential helper is used to cache HTTPS remote Git hosting service credentials (username/password or token)
You can used that helper to query credentials manually:
credhelper=$(git config credential.helper) printf "host=github.com\nprotocol=https" | git-credential-${credhelper} getThis works for any Mac/Linux/Windows cached credentials.
And if you want to set a new password/token, it is even more cumbersome:
credhelper=$(git config credential.helper) printf "host=github.com\nprotocol=https\nusername=VonC\npassword=xxx" | git-credential-${credhelper} set- Replace the complex command line by a tool able to quickly read/set/erase cached credentials, no matter your credential helper.
- Cross-platform.
git-credwill read your current credential helper- By default, in a repository, it will display cached credentials for the current folder/repository
Since the executable follows the naming convention git-xxx (here git-cred or git-cred.exe), that means you can also type:
git cred.
As if "cred" was a git command. It works if the executable git-cred(.exe) is in your $PATH/%PATH%.
get is the default command for git-cred.
You do not need to add get.
git cred -u VonC -s github.com # or (same) git cred -u VonC -s github.com getcd /path/to/local/github.com/cloned/repository git cred # or (same) git cred getgit cred -u VonC -s github.com set <password or token>cd /path/to/local/github.com/cloned/repository git cred -u VonC set <password or token>git cred -u VonC -s github.com erasecd /path/to/local/github.com/cloned/repository git cred -u VonC erase