7

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

Evan
  • 1,892
  • 2
  • 19
  • 40
  • There is no `user.password` setting. We see this exact item (`user.password`) a lot here, implying there's some sort of bad tutorial or help-system thing out there claiming that there is such a setting. It would be good to get this fixed at its root. Do you remember why you thought `user.password` might exist? – torek Aug 13 '21 at 22:32
  • Yeah I think it's because I saw it here: https://stackoverflow.com/a/51327559/11634814 when I was just skimming through, I see now that the answer says you shouldn't do this though/it's old, outdated, and insecure – Evan Aug 13 '21 at 22:37
  • @torek Indeed 'git config -l' does not list any 'user.password'. However, in ubuntu 18.04 after a github token expiration, I used the command 'git config --global --unset user.password' . After that git did ask again for username/password. I have used that in the past again. Would love to find out why it works, and why it should not. That is why I post that after reading your comment. PS I did not reclone my repo. – Spyros K Nov 29 '21 at 09:58
  • @SpyrosK: Hm, so maybe there is some (non-Git) software that reads user.password as part of a (not Git supplied) credential helper. It would be good to track this down... – torek Nov 30 '21 at 04:26
  • @torek If the git credential store ( https://git-scm.com/docs/git-credential-store ), then this could be an explanation. However I a first glance of the documentation did not provide any evidence. – Spyros K Nov 30 '21 at 18:30

2 Answers2

7

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.

Evan
  • 1,892
  • 2
  • 19
  • 40
  • This is not a good solution for MacOS users. It replaces your login credentials for safari, and may break subsequent third party oauth links to your github account depending on token permissions. – Joshua Kolden Aug 18 '21 at 17:31
  • You should create an entry with name=git:https://github.com, Kind=Programme password, Account=your github username, where=git:https://github.com. The cleanest way to do this however is to brew install gh and then run gh auth login. This adds the correct entry into your keychain (see: https://stackoverflow.com/a/68780014/2562707). – Joshua Kolden Aug 18 '21 at 17:33
0

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

enter image description here

Floydovich
  • 106
  • 2
  • 4