GitHub Authentication

To work with GitHub from your local system, you must establish a secure authentication method. As of 2021, GitHub no longer supports password authentication for local repository access. Instead, you can utilize one of the following authentication methods:

GitHub CLI Authentication

This is a user-friendly way to authenticate without repeatedly entering your username and password. Enter the following in WSL:

During authentication, the command will prompt you with a series of questions. Default answers are provided, so simply press "Enter" to accept each:

Following the prompts, you'll receive a one-time code. (Note: Your code will differ from the example.)

For WSL users: If the following error arises from the system not opening the browser, simply open any browser (even on another device) and sign into your GitHub account.

To authenticate:

  1. Navigate to https://github.com/login/device
  2. Enter the provided one-time code.

Once authenticated, you'll see a confirmation message in WSL with your GitHub username:

You've now securely authenticated with GitHub. Your git operations will not require repeated username or token inputs.

BTW, this process resembles "Device Code Flow" or "Device Authorization Grant" from OAuth 2.0.