Git push “fatal: Authentication failed ”

本文解决了在GitHub上使用Git推送时遇到的“fatal:Authentication failed”错误。问题源于账户启用了两步验证,导致无法通过HTTPS使用账户密码进行推送。解决方案包括生成个人访问令牌并使用该令牌作为密码,同时更新远程仓库设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Git push “fatal: Authentication failed ”

问题原因

  • 之前设置了两步验证
 If you enabled two-factor authentication in your Github account you won't be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your Github account. Using this token as your password should allow you to push to your remote repository via HTTPS. Use your username as usual.

解决方法

  • 更新分支
git remote -v 
git remote remove origin 
git remote add origin git@github.com:user/repo.git  

847278-20190702222853095-629017189.png

## 参考资料

[1].Git push results in “Authentication Failed”

转载于:https://www.cnblogs.com/OneFri/p/11123584.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值