DEV Community

Cover image for Mac Tips: How to Use KeyChain to Manage Your GitHub Credentials
Mezbah Alam
Mezbah Alam

Posted on

Mac Tips: How to Use KeyChain to Manage Your GitHub Credentials

Are you tired of constantly being prompted for your GitHub password every time you want to push or pull a repo? Look no further than Mac's KeyChain feature.

When you clone a repository over HTTPS, Git may prompt you for your password each time you want to push or pull. But with Mac's KeyChain, you can easily store your GitHub credentials and never have to remember your password again.

First, make sure that you have the git credential-osxkeychain command installed. If not, simply install Git using the Homebrew package manager by running the command "brew install git" in your terminal.

Once you have that installed, tell Git to use KeyChain for storing your credentials by running the following command:

git config --global credential.helper osxkeychain
Enter fullscreen mode Exit fullscreen mode

After running this command, the next time you clone a repo via HTTPS, you'll be prompted to grant access to KeyChain. Once you do that (always allow), any future authentication will be done transparently by Git reading the KeyChain record. No more remembering passwords, or repeatedly typing them in – it's that easy!

So, next time you are cloning a repo and prompted for a password, follow these simple steps and keychain will help you to store the credentials and you can easily pull or push the repos with out the need of providing password.

Top comments (0)