赞
踩
git push origin main时发生错误,说是不支持密码输入
sqh@VM-20-2-ubuntu:git push origin master
Username for 'https://github.com': songqinghao
Password for 'https://songqinghao@github.com':
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/songqinghao/shared-bike.git': The requested URL returned error: 403
生成token
1.点击setting
2.点击开发者设置
3.点击personal access token
4.generate new token
会生成这个码,一定要记得保存起来,否则重新刷新页面就会消失
方法一
在我们git push origin main
以后输入username完了以后密码就用上面复制的token码代替,这样就可以成功push,但是这样每次push都要重新输入token,雀实有点麻烦——》用方法二
方法二
重新设置远程仓库,将token也带进去,这样后面我们就可以直接git push了,也不用反复输token
git remote set-url origin https://[tokenkey]@github.com/[username]/[repName].git
tokenkey:就是上面复制的那个token码
username:你在git上面用的用户名
repName:就是你想要远程的仓库
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。