赞
踩
$ git remote add <远程库别名> https://github.com/<用户名>/<远程库名>.git
git push <远程库别名> master
时需要输入用户名和密码进行登录,无论密码是否正确,输入后就会出现以下的报错: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/<用户名>/<远程库名>.git/'
翻译下:用户名和密码登录的方式在2021年8月13日开始被移除了,应该使用 token个人令牌来登录
git remote set-url origin https://<Token>@github.com/<用户名>/<远程库别名>.git
但是可能会出现以下报错
error: remote <远程库别名> already exists.
翻译:" 远程库已存在 ",还记得前者是通过
$ git remote add <远程库别名> https://github.com/<用户名>/<远程库名>.git
链接的远程库,此时再次链接,注意这两次链接的远程库别名一致,当然会报错远程库已存在
$ git remote rm origin
貌似这种方法有个弊端,就是会将本机链接的远程库全部断开,就是你链接了两个,执行后那么两个都会断开,我比较建议是链接哪个远程库有问题就先断开哪个
$ git remote remove <要删掉的远程库别名>
$ git remote add <远程库别名> https://<Token>@github.com/<用户名>/<远程库别名>.git
问题得到完美解决~
以上为本人学习 Git 遇到问题总结的笔记(经验),如有遗漏或者错误欢迎各位指正
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。