Skip to content

Instantly share code, notes, and snippets.

@SOSANA
Last active March 24, 2022 03:18
Show Gist options
  • Save SOSANA/ffff7cb501ca6f87494d30d5d1fe0386 to your computer and use it in GitHub Desktop.
Save SOSANA/ffff7cb501ca6f87494d30d5d1fe0386 to your computer and use it in GitHub Desktop.
How to save a GitHub password globally on your personal device using Git
# Attention: This method saves the credentials in plaintext on your PC's disk. Everyone on your computer can access it, e.g. malicious NPM modules.
# Run
git config --global credential.helper store
# Then
git pull
# Provide a username and password and those details will then be remembered later. The credentials are stored in a file on the disk, with the disk permissions of "just user readable/writable" but still in plaintext.
# If you want to change the password later
git pull
# Will fail, because the password is incorrect, git then removes the offending user+password from the ~/.git-credentials file, so now re-run
git pull
# to provide a new password so it works as earlier.
# SRC: https://stackoverflow.com/a/35942890/2129978
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment