Introduction
In August 2021 GitHub changed the access security. Login with user and password are not longer allowed. Instead of password, GitHub expects a personal access token. This post summarizes how to implement command line access to GitHub with a personal token. On MacOS.
The solution I put in place is based on a GitHub Command Line Interface (CLI) Credential manager (GCM). Here are the steps to make it work:
-
Open the Terminal
-
Install the GCM with brew:
$ brew install gh
- Run the command
$ gh auth login
You will be prompted to answer a series of questions:
% gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Paste an authentication token
Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
The minimum required scopes are 'repo', 'read:org', 'workflow'.
? Paste your authentication token: ****************************************
To generate the Personal Access Token I used the link https://github.com/settings/tokens. The token is only shown once and you have to copy it directly, then paste it at the command line.