Saving your Git Repo Password¶
When pushing back up to your own git repo, when using HTTPS for the address, it should ask for your password, and if you have your username in the repo address, it’ll bypass that. But, you are able to cache your password, if you have fairly frequent pushes or trust the system you’re using.
Of course, depending on the system you are using, depends on how long that info is cached:
- If you’re on a linux machine, there is a specific time you can program in for caching
- If you’re on macOS, it caches that info up to your Keychain, therefore its accessible so long as you’re logged into the machines account its saved to
These caching programs have the moniker
In your macOS’s terminal, to see if
osxkeychain helper is already installed:
git credential-osxkeychain usage: git credential-osxkeychain <get|store|erase>
If its not downloaded, it’ll prompt you to retrieve the Xcode Command Line Tools that you have to have to do much of anything terminal-wise on macOS. That output will tell you what to do in that event.
Next, you have to tell
git, through config files, to utilize the credential helper.
git config --global credential.helper osxkeychain
Now, the next time you try to do anything requiring that git password, it’ll prompt you for the info, and then automatically save it in your keychain.