As of August, 2021, GitHub removed authentication to repositories via password. There are a few ways to do authentication sanctioned by GitHub. Below is one method via GitHub CLI, abbreviated gh
. There is a second method: GitHub Personal Access Token, described here.
Using GitHub CLI (gh
) to Authenticate to GitHub
GitHub CLI is a separate program that must be installed. Go to the releases page at https://github.com/cli/cli#installation. Follow the method for your operating system. I do not have any of the recommended installers on my system so I'd like to install it via Windows. This is referred to as MSI. See the line below:
Click through to the releases page. Most Windows installs to include Windows 10 and Windows 11 will use GitHub CLI {version} windows amd64 installer
where {version} was 2.39.1 when this section was written but is likely to be higher in the future. Click that link and save the file in your Downloads folder. Go to Downloads and click the file. You will have the installer open up with a small screen like the one below.
For mac and linux, the installation page will have a number of methods to install GitHub CLI via the command line. Go ahead and use the method best suited to your computer.
Click the Next button then Next again and then Install. When a security dialog pops up, accept. Then click the Finish button.
The manual for GitHub CLI is here.
You will want to close any command line windows then open a new one. For Windows, either a command line prompt or Git bash. The gh command will be available.
Type gh auth login
You will get a set of prompts, use the following. You'll be provided a code in the form XXXX-XXXX where X=an upper case letter or number. Note the code you get will be unique to your login and will change on subsequent logins.
In a browser, you will be asked to enter the code from above. Once that is done, you'll need to perform your authentication. I have my credentials in Google Authenticator but there are several different programs which do the same. Go to your authentication app and type in your number next to GitHub.
If you type in the correct code, you'll be authenticated:
And in your command line window (here git bash):
Once authenticated, privileged git operations will work on GitHub.
Page last edited March 08, 2024
Text editor powered by tinymce.