I work on several computers, and I would make sure than git never stores my password while I push. So in short I want git to always ask for my github password.
Is that possible?
I am frustrated than on Mac, for some reason it always store my password in a keychain and I have to remove it manually each time.
I'm using the command line.
EDIT:
This answer gave me a clue to solve the problem:
How do I disable git's credential helper for a single repository?
In the terminal run this:
git config --local credential.helper ''
Alternatively you can edit your .git/config file and have this:
[credential]
helper = ''
I don't have the root password (for some reason an admin password is not a valid root password, go figure).
To save username and password in Git, open your “GitHub” remote repository and copy its “URL”. Then, launch “Git Bash”, paste the “URL” with the “$ git clone” command, specify the credential and execute it. Lastly, run the “$ git config –global credential. helper store” command to save the credential in the “.
You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.
Why Git Keeps Prompting you for Username and Password. Using HTTPS remote URL is useful if you need to work through strict firewalls and proxies but this also means that you'll get prompted for your GitHub username and password each time you pull or push your code to your repository.
git config --global --unset credential.helper
git config --system --unset credential.helper
In Windows: Open User Accounts by clicking the Start button Picture of the Start button, clicking Control Panel, clicking User Accounts and Family Safety (or clicking User Accounts, if you are connected to a network domain), and then clicking User Accounts. In the left pane, click Manage your credentials. Windows 7: Control Panel\User Accounts\Credential Manager
Trick: https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage you can change remember permission timeout to 0 (zero).
macOS
Try running /Applications/Utilities/Keychain Access
Right click, choose Delete
If you want use command line from macOS Terminal, type
git credential-osxkeychain erase
host=github.com
protocol=https
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With