GitHub Passwords on the CLI

Lois T.
2 min readNov 20, 2023

--

When you need to access GitHub through the CLI

Photo by Rubaitul Azad on Unsplash
Sample CLI prompt

If you’ve gotten an error message when you entered your GitHub password into the CLI prompt, this is because GitHub does not allow the entering of passwords through the CLI anymore. Contrary to the prompt, you should not use your “password”, but rather, an access token here.

To create a Personal access token, log in to GitHub and click on your profile picture on the top right.

  1. Select Settings > Developer settings > Personal access token > Tokens (classic).
  2. Click Generate new token. Enter a note, e.g. AWS CodeDeploy
  3. Select the minimum for Expiration — e.g. 7 days if you just need to clone the repository.
  4. Do not forget to give the access scopes. Under Select scopes, check the minimum settings that you require, e.g. repo only if you just want to clone a respository.
  5. Click Generate token.
  6. Copy the generated token and save it in a safe place, because you will not be able to see it again.
  7. Paste this token when prompted in the CLI. (It is normal to see nothing actually pasted) Type Enter.

--

--

Lois T.
Lois T.

Written by Lois T.

I make web-based systems and recently AI/ML. I write about the dev problems I meet in a simplified manner (explain-like-I’m-5) because that’s how I learn.