GitHub change from password to personal access token without re-cloning the repo

Viewed 2452

As of today seems GitHub has disabled passwords through the command line and instead requires personal access tokens, as you get this error when trying to push a commit: "remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead."

I went and generated a personal access token, but most of the tutorials I've seen say that you essentially should reclone the repo again, and then "log in" with your personal access token before you can commit again.

However, I have a lot of repos that use the older password method, and I'd rather not reclone every single one. Is there a way to somehow tell Git, "hey I'd like to change my password for login" in my current repos. I was hoping when I pushed I would automatically just be prompted for my password again, but instead I'm just given the error message above, and I don't see how I can re-enter my login info without recloning and trying to push again.

I tried git config --global --unset user.password but that didn't seem to fix the issue.

Thanks

2 Answers

Update: Figured it out and figured I'd leave this question up since seems relevant due to this recent change. For people on a Macbook, go to KeyChain Access from the Finder, and search for github. Double click the github.com option: enter image description here

press the show password button on the menu that pops up, and swap that out for your personal access token generated.

On Windows, open Credential Manage and edit git:github credentials copy-pasting your generated token into the password field.

enter image description here

Related