git push报错:gnutls_handshake() failed: The TLS connection was non-properly terminated

这篇具有很好参考价值的文章主要介绍了git push报错:gnutls_handshake() failed: The TLS connection was non-properly terminated。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

首先你在本地或服务器git clone了一套代码,或者是clone了自己的代码准备更新,更新过内容后,你想用git push origin main这个命令,将本地代码推送到github上,结果报错gnutls_handshake() failed: The TLS connection was non-properly terminated。

我首先检查了一下自己的命令,没有错,通过了git add . 也进行了git commit -m "update",最后用了git push origin main,第一次push的时候还好使,第二次就报错了。

短暂解决方案

在命令行中输入这个命令,更新。但这种方法无法解决根本问题,第二天又不行了。

sudo apt-get update

靠谱解决方案——配置ssh

  1. 首先检查服务器是否有ssh密钥,如果有,在~/.ssh/目录下可以看到id_rsa和id_rsa.pub,其中id_rsa.pub是公钥。如果没有通过以下命令生成,生成后可以在~/.ssh/目录下看到id_rsa和id_rsa.pub。
    ssh-keygen -t rsa -C "youremail@example.com"
  2. 将id_rsa.pub文件中的内容复制到github。找到github的settings,找到ssh and GPG keys,创建一个新的ssh key,将从id_rsa.pub文件中复制的内容,粘贴到刚刚创建的ssh key中。

    gnutls_handshake() failed: the tls connection was non-properly terminated,踩坑笔记,git

    gnutls_handshake() failed: the tls connection was non-properly terminated,踩坑笔记,git

  3. 回到系统命令行中用该命令测试
    ssh -T git@github.com

    如果出现这个结果就说明成功了,如果出现其他的,没连上之类的,可能是ssh key有问题gnutls_handshake() failed: the tls connection was non-properly terminated,踩坑笔记,git

  4. 重新设置远程仓库的ssh连接,再push就成功了

    git remote rm origin
    git remote add origin git@github.com:your_username/your_repository_name.git
    git push origin main

 记录自己踩过的坑,下次迈过去就好啦~文章来源地址https://www.toymoban.com/news/detail-847951.html

到了这里,关于git push报错:gnutls_handshake() failed: The TLS connection was non-properly terminated的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【git 报错】:git push 提示error:failed to push some refs to “xxxxxx“

    在git push操作提交一个文件到远程库的时候报错:error: failed to push some refs to ‘https://gitee.com/gitee-zhangchq/stm32.git’ 翻译: 错误:无法将某些引用推送到’https://gitee.com/gitee-zhangchq/stm32.git’ 由于这是一个在gitee上面新创建的一个远程库,然后在创建远程库的时候还选择了自动生

    2024年02月17日
    浏览(45)
  • git push报错:error: failed to push some refs to ‘https:/

    根据提示,翻译是要合并的库和本地库不一致,要先执行git pull操作 在网上找了一些解决方案,都是执行如下指令 但是并没有解决我的问题,也没有一些更好的解决方案。 仔细思考了下,我要并入的并不是master这个主分支,而是我创建的一个新分支shuwwl_new_br 于是将上述指令

    2024年02月11日
    浏览(97)
  • 【问题解决】Git报错:failed to push some refs to xxxxx

    To https://xxxxxxxxxxxx.git ! [rejected] master - master (fetch first) error: failed to push some refs to ‘https://xxxxxxxx.git’ hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hin

    2023年04月15日
    浏览(37)
  • git提交报错error: failed to push some refs to ‘git url‘

    想把本地仓库提交到远程仓库,报错信息如下 git提交报错信息 error: src refspec master does not match any error: failed to push some refs to \\\'git url\\\' 错误原因: 我们在创建仓库的时候,都会勾选“使用Reamdme文件初始化这个仓库”这个操作初识了一个README文件并配置添加了忽略文件。当点击创

    2024年01月22日
    浏览(37)
  • git 常遇到的几种错误(failed to push some refs to ,The requested returned error: 403)

    一、error: failed to push some refs to ‘https://gitee.com/xxx/xxx.git‘错误的解决方法。 解决方法1:直接输入git push origin master -f 强行把本地的分支覆盖掉远程仓库的分支 解决方法2:出现错误的主要原因是gitee(github)中的README.md文件不在本地代码目录中 ,所以我们只需要git pull --rebase

    2024年02月13日
    浏览(37)
  • 【git报错】git push时候报错fatal: unable to access ‘http://xxxxxxxxxxxx.git/‘: Failed to connet to xxxxx

    在执行git push origin master要把代码推送到远程库的时候出现了报错:fatal: unable to access ‘http://xxxxxxxxxxxx.git/’: Failed to connet to xxxxx 先是在博客上(https://blog.csdn.net/cubejava/article/details/120631396)看到是说:一般是这是因为服务器的SSL证书没有经过第三方机构的签署,所以才报错,

    2024年02月16日
    浏览(36)
  • git使用push命令报错-error: failed to push some refs to ‘https://gitee.com/MFLU/graduation_design.git‘

    当我们使用git操作向远程仓库push代码时,可能会报错: hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., \\\'git pull ...\\\') before pushing again. hint: See the \\\'Note about fast-forwards\\\' in \\\'git push --help\\\' for details. 主要原因

    2024年02月04日
    浏览(34)
  • git push 报错unable to access https://gitee.com/****/***.git/ : The requested URL returned error:403

    对于git小白来说,第一次使用git总会报各种稀奇古怪的错误。 最近的操作git的时候,就报了如上的错误fatal: unable to access  https://gitee.com/****/***.git/ : The requested URL returned error:403 对于这样的错误无非就是无权访问的问题, 解决的方法我试过的只有两种 : 1 .自己的git账户本身

    2023年04月08日
    浏览(34)
  • 【Git】push分支报错:fatal: The current branch 当前分支名 has no upstream branch

    示例代码: feature/file 是分支名 中文释义: 在于当前这个分支没有和任何的仓库发生关联,origin是仓库的一个指针,需要将当前的分支与这个指针之间形成关联。 直接允许以下命令即可 执行之后会在 github 上自动新建一个 feature/file 的分支。

    2024年02月11日
    浏览(48)
  • git push报错:![rejected] master -> master(non-fast-forward) error:failed to push some refs to XXX

    背景 本地git库,要push到gitlab上,执行完如下命令后报错: 报错信息为: 原因 从本地代码创建远程仓库的时候,添加了README.md,但本地仓库中并没有该文件。 解决方案 添加忽略不相干的历史选项,将远程仓库中的文件重新拉取到本地,这样本地文件会出现README.md: 之后再

    2024年02月04日
    浏览(48)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包