Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...