You must authenticate with your local system to work with GitHub. GitHub removed the password authentication for local repository access in 2021. Here are the 3 ways to authenticate:
gh auth
command 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
command insteadgh auth
command, but the way that professionals (and software) authenticate to systems of all kinds. More details later.gh auth
commandgh
To set up cached authentication:
The command will ask a series of questions. Here are the default answers that you can use the enter key for each:
You will then see something like the following instructions:
If you are in WSL, you probably can't open the browser in Windows from a WSL shell. If that is the case, go to the following URL https://github.com/login/device in any browser, even on another machine. Log into your GitHub account in the browser. Then, enter the one-time code.
You now have authenticated to GitHub and should be able to use git
without re-entering your username and personal access token.
You can clone a repository from GitHub using a URL. This requires a username and a personal access token. The token is created at GitHub with selected permissions, and the same token can be used to clone on multiple local installations.
If you want to do this, find instructions online, as I discourage this approach. Use gh auth
command instead.