The following requires the installation of git
and gh
. If you have not done so, see Development Environment: Git.
You need to authenticate your local system to work with GitHub. Here are three different ways to do so:
gh auth
The standard GitHub CLI (Command Line Interface) gh
. The gh
command can do much of what you can do at GitHub that is not git
. It can easily set up authentication and cache your credentials without a personal access token. The easiest way to authenticate, and highly recommendedgh auth
insteadgh auth
, but how professionals (and software) authenticate to systems of all kinds. More details later.gh auth
To set up cached authentication with gh
:
The command will prompt a series of questions. Below are the default answers. Press enter for each:
You will then see instructions similar to the following:
If you are using WSL, you may not be able to directly open a web browser in Windows from a WSL shell. If that's the case, log into your GitHub account in any browser and visit the following URL:
https://github.com/login/device
Then, enter the one-time code.
You have successfully authenticated with GitHub, so you can now use git
and gh
without re-authenticating.