github removed username/password authorization. Now what?

Viewed 6295

August 13, 2021 github removed the username/password authorization for command-line commands. So I went and got a PAC (Personal Access) token.

So when I clone an existing repo, cd to that subdir/repo, modify/create a file and then commit the change. That all works just fine.

HOWEVER

when I do: git push -u origin

It asks for my username and password. After spending hours on google, I read that I'm supposed to use my PAC as the password. But when I do that I get: remote: Invalid username or password. Fatal: Authentication failed for <the repo I'm trying to update on github?

This worked fine just a few weeks ago. What am I doing wrong? Getting desperate to make this work.

TIA Bill W

5 Answers
  1. Create new personal token in your github account at

    Settings -> Developer Settings -> Personal access token -> Generate Token

  2. Change your remote url with:

    git remote set-url origin https://[token]@github.com/[username]/[repository]

Actually, it's easier to access your repository with SSH.

  1. Make sure you have installed OpenSSH Client.
  2. Generate a new key pair by running ssh-keygen if you don't have one. (Passphrase can be none)
  3. Run cat ~/.ssh/id_rsa.pub and copy the output.
  4. Go to https://github.com/settings/ssh/new and paste into "Key" field, then give it a "Title".
  5. Click "Add SSH key".

Now, you're all set.

From now on, you can access your repositories with SSH with the URL git@github.com:<username>/<repository>.git instead of https://github.com/<username>/<repository>.git.

Plus, you still need to manually change the remote URL of the existing repositories to git@github.com:<username>/<repository>.git to apply your new SSH access method.

For more details, check out https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

1.Create new personal token in your github account at

Settings -> Developer Settings -> Personal access token -> Generate Token

2.Updating Credentials Manager .

To open Credentials Manager search that setting or navigate to: Control Panel\All Control Panel Items\Credential Manager

In Generic Credentials find your repo and update username/password.Change password to Personal access token .

GitHub no longer supports basic authentication using a username and password. Instead, we recommend using personal access tokens or the web application flow.

if you are using a password to authenticate against the GitHub API today, you must begin using a personal access token to avoid disruption. If you receive a warning that you are using an outdated third-party integration, you should update your client to the latest version.

Creating a token

  1. Go to settings -> Developer settings.-> Personal access tokens.-> generate new token
  2. Give your token a descriptive name.
  3. Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select repo.

Using the token

git clone https://github.com/username/repo.git
Username: your_username
Password: your_token

Well. Thank you github for being Big Brother!

To test my procedures, I copied by .bashrc file to the repo via the GUI

Then I added a 2nd file to my local directory/repo. Added, committed and when I would do the push, it would fail.

Apparently, GITHUB scanned the files in my repo, saw the renamed .bashrc file, and an entry with the github token I had been trying to use. GITHUB then cancelled the token and sent me an email to notify me of this action.

The problem is that it took an hour or so for me to get the email and notice it was from GITHUB. GRRRRRRRRR

Created a new token and now all is right with the world. I'm just missing a few more hairs on the top of my already sparse head.

Related