记git报错

467 阅读2分钟
报错内容
npm ERR! Error while executing:
npm ERR! D:\WorkTools\Git\cmd\git.EXE ls-remote -h -t https://github.com/nhn/raphael.git
npm ERR! 
npm ERR! fatal: unable to access 'https://github.com/nhn/raphael.git/': OpenSSL SSL_read: Connection was reset
npm ERR! 
npm ERR! exited with error code: 128
参考文章

blog.csdn.net/weixin_4493…

解决方案

cmd执行命令清除DNS缓存,ipconfig后面有个空格

ipconfig /flushdns
报错内容
Failed to connect to github.com port 443: Timed out
解决方案

两种:
1.windows代理导致,将科学上网关闭即可
2.git_bash上运行

 git config --global --unset http.proxy
报错内容
OpenSSL SSL_read: Connection was reset
解决方案

接触ssl限制

git config --global http.sslVerify "false"
报错内容
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: Authentication failed for 'https://github.com/PureDownload/test-service-java.git/'
报错原因

github.blog

参考链接 (5条消息) github开发人员在七夕搞事情:remote: Support for password authentication was removed on August 13, 2021._星空-CSDN博客

需要将登录密码改为token
更改步骤: GitHub首页->settings -> Developer setting -> Personal access tokens -> Generate new token ->
在生成token页面选择时间 权限等信息

  • 要使用token从命令行访问仓库,请选择repo
  • 要使用token从命令行删除仓库,请选择delete_repo
  • 其他根据需要进行勾选 -> 使用token登录提交即可
注意事项
  • token只会存在一次,保存下来
  • 如果 push 等操作没有出现输入密码选项,请先输入如下命令,之后就可以看到输入密码选项了
git config --system --unset credential.helper

对应记住账号命令

git config --global credential.helper store
后续

也可以 把token直接添加远程仓库链接中,这样就可以避免同一个仓库每次提交代码都要输入token了:

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

  • your_token:换成你自己得到的token
  • USERNAME:是你自己github的用户名
  • REPO:是你的仓库名称