Store Git Credentials Securely

Store Credentials Securely

Do not use credential.helper store for normal use. Although it can be configured in one repository, it writes credentials in plaintext to a user-wide file (usually ~/.git-credentials), not to that repository.

On macOS, store HTTPS credentials in the Keychain instead:

git config --global credential.helper osxkeychain

Then run a Git operation such as:

git pull

Git will ask for your username and password or personal access token once and save it in the Keychain. On other platforms, use an appropriate secure credential helper, such as Git Credential Manager.