github push 要求密码,但是密码已经弃用的解决方案

发布时间 2023-05-04 17:11:24作者: yinhuachen

参考资料:https://bobbyhadz.com/blog/support-for-password-authentication-was-removed-on-august

 

1. 创建 github personal access token

  1. Visit https://github.com and in the upper-right corner, click on your profile picture and then click Settings.

click profile photo click settings

  1. In the left sidebar, click on < > Developer settings.

click developer settings

  1. In the left sidebar, click on Personal access tokens and then Tokens (classic).

  2. From the Generate new token dropdown menu select Generate new token (classic).

generate new token classic

  1. Give your token a descriptive name.

give your token a name

  1. Select when the token should expire from the dropdown menu. I'll use the default expiration of 30 days.

  2. I'll check all checkboxes in the Select scopes section, but you can only select the scopes you require for fine-grained control.

select scopes check all checkboxes

  1. Click on the Generate token button.

click generate token

  1. IMPORTANT - Make sure to copy your Personal Access Token now. You won't be able to see it again.

copy personal access token

  1. Treat your access token like a password. You can enter your token instead of your password when performing Git operations over HTTPS.

  2. Store your Personal Access token in a local file or in a secure remote password manager.

 

 

If you need to clone a private GitHub repository or push to a repository, you can use your Personal Access Token when you get prompted for a password.

 

 

以后输入密码输入这个 personal token 就行