github: git push not support password

川普发动贸易战之后就没有动过 github 账号, 今天新建一个 repo 遇到问题,记录一下.

环境: MacBookPro

1.  git push LibreSSL

➜  foodtrucks-api git:(master) git push
fatal: unable to access 'https://github.com/<username>/foodtrucks-api.git/': LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60

# resovled
➜  foodtrucks-api git:(master) git config --global http.sslBackend "openssl"

2. git push - Support password authentication was removed on August 13, 2021.

不再支持密码认证

➜  foodtrucks-api git:(master) git push                                     
Username for 'https://github.com': {your username}
Password for 'https://{username}@github.com': 
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/{username}/foodtrucks-api.git/'

github: Personal Access Token

on your github profile: Setting -> Developer settings -> Personal access tokens -> Generate new token (I choosen classic) -> set the expire date and so on -> generate

步骤:

1. 进入Setting

2. 拉到最后的Developer settings

3. 点击 Personal access tokens

4. 生成token :Generate new token

5. 设置名字、token时长(最后一个选项是永不过期),最后生成即可

6. 复制好token,最好保存好

7. 回到git进行设置

Run on local:

// <your_token>:刚刚生成的token

// <REPO>:要访问的仓库名称,当前仓库的名称

git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git

// <your_token>:刚刚生成的token
// <REPO>:要访问的仓库名称,当前仓库的名称
git remote set-url origin  https://<your_token>@github.com/<USERNAME>/<REPO>.git

git push

Resolved!!!

Reference: Git 更新后不再支持密码输入【解决方案】 Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. - 未配妥剑,已入江湖 - 博客园

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值