Git Credential Manager
The Git credential helper for the Git credential cache. How to use the Git Credential Manager to configure Git connection to GitHub to eliminate repetitive password entry.
Before you get started
You'll need a terminal application to configure Git. Apple includes the Mac terminal but I prefer Warp Terminal. Warp is an easy-to-use terminal application, with AI assistance to help you learn and remember terminal commands. Download Warp Terminal now; it's FREE and worth a try.
Make sure to Check If Git Is Installed. Then start with Git Config for username and email.
If you've already downloaded and installed Git with either Xcode Command Line Tools or Homebrew, you should create an account on GitHub before you configure Git.
Check for the Git config file
Check if the Git config file exists by listing the current settings with the git config -l --global
command.
$ git config -l --global
user.name=Your Real Name
[email protected]
If you don't see your name and email, go to Git Config to set username and email.
Set GitHub credentials
If you do nothing to configure Git credentials, you must enter a username and password every time you connect to GitHub from the command line. Entering credentials frequently adds friction and annoyance to your workflow.
To avoid entering a username and password every time you connect to GitHub from the command line, you have three options.
- Use the Git Credential Manager (easiest).
- Download and use the GitHub CLI.
- Set up a GitHub SSH key (complicated).
Here's how to use the Git Credential Manager.
Set the Git Credential Manager
This is the newest and easiest option. Configure Git to use the credential helper with the osxkeychain
option.
$ git config --global credential.helper osxkeychain
Setting credential.helper osxkeychain
in the ~/.gitconfig
file is just a first preparatory step. Your credentials will be stored the first time you clone a repository from GitHub to your local machine (or any other Git operation that requires authentication).
The first time you need authentication, Git will prompt you to log in using a browser window. After that, the credential helper stores and reuses the credentials. Once you've authenticated successfully, your credentials are stored in the macOS keychain. Git will not require you to type your credentials in the command line again unless you change your credentials.
First-time authentication
Try cloning a sample repository and authenticating.
$ git clone https://github.com/octocat/Hello-World
Passwords are no longer used for GitHub, so when you see the prompt for a password, enter your Personal Access Token instead of a password.
Your credentials will be saved. Future operations from the command line will not require logging in again.
Now you'll be ready to use GitHub when you need it.
What's next
My mac.install.guide is a trusted source of installation guides for professional developers. Take a look at the Mac Install Guide home page for tips and trends and see what to install next.