GnuTLS接收错误(-110):TLS连接未正确终止。

12
我正在准备使用vundle安装vim插件youcompleteme,在我设置vimrc之后。
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()

Plugin 'gmarik/Vundle.vim'
Plugin 'valloric/youcompleteme'

call vundle#end()

我输入了:PluginInstall,但出现了错误。
  2 [2018-09-27 10:47:17] Plugin valloric/youcompleteme                                                | 18 " line enables syntax highlighting by default.
  3 [2018-09-27 10:47:17] $ git clone --recursive 'https://github.com/valloric/youcompleteme.git' '/roo| 19 syntax on;
    t/.vim/bundle/youcompleteme'                                                                       | 20 if has("syntax")
  4 [2018-09-27 10:47:17] > Cloning into '/root/.vim/bundle/youcompleteme'...                          | 21   syntax on
  5 [2018-09-27 10:47:17] > error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was| 22 endif
     non-properly terminated. 

然后我进入目录 ~/.vim/bundle 并执行以下命令:

git clone --recursive 'https://github.com/valloric/youcompleteme.git

并且,听好了

Cloning into '~/.vim/bundle/youcompleteme'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 34431 (delta 4), reused 8 (delta 1), pack-reused 34416
Receiving objects: 100% (34431/34431), 32.58 MiB | 2.37 MiB/s, done.
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Resolving deltas: 100% (12305/12305), done.

此处所述,尽管出现错误,插件似乎已经下载完毕。但实际上我找不到youcompleteme目录。

我也试过

git clone --recursive 'git@github.com:Valloric/YouCompleteMe.git' '~/.vim/bundle/youcompleteme'

并且,听好了

Cloning into '~/.vim/bundle/youcompleteme'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

那么如何解决这个问题呢?

7个回答

36
重新编译并安装git,最终解决问题。步骤如下:
sudo apt-get install build-essential fakeroot dpkg-dev -y
sudo apt-get build-dep git -y
sudo apt-get install libcurl4-openssl-dev -y
cd ~
mkdir source-git
cd source-git/
apt-get source git
cd git-2.*.*/
sed -i -- 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/' ./debian/control
sed -i -- '/TEST\s*=\s*test/d' ./debian/rules
dpkg-buildpackage -rfakeroot -b -uc -us
sudo dpkg -i ../git_*ubuntu*.deb

不使用-y也可以,-y只是为了跳过输入y。结果如下:

Cloning into 'syntastic'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 18671 (delta 9), reused 16 (delta 5), pack-reused 18644
Receiving objects: 100% (18671/18671), 4.26 MiB | 701.00 KiB/s, done.
Resolving deltas: 100% (10572/10572), done.
Checking connectivity... done.

3
非常感谢,它在Ubuntu 18.04上确实完美运行! - Reupiey
3
在多年来我在 Stack Overflow 上找到的答案中,这是最好的一个。不管你在哪里,你应该得到一杯啤酒。 - scniro
2
在“软件和更新”应用程序下启用“源代码”修复了上述问题。 - Karthick Jayaraman
这个很好用!我在一个focal-20201106的docker容器中。在/etc/apt/sources.list文件中取消注释带有# deb-src...的行,并运行apt-get update命令。执行apt-get source git命令后,目录中有三个文件:git_2.25.1-1ubuntu3.dscgit_2.25.1-1ubuntu3.debian.tar.xzgit_2.25.1.orig.tar.xz。解压缩.orig.文件会创建git-2.25.1/目录。然后在git-2.25.1/内部解压缩-1ubuntu3.文件。从那里运行其余的命令。 - minghua
帮助我在Raspbian GNU / Linux 10(buster)上为我们公司使用的Bitbucket存储库进行了设置。 但是最后一行需要更改为:sudo dpkg -i ../git_2.20.1-2+deb10u3_armhf.deb - Stretchdude
显示剩余3条评论

8

以下是一种更实用的方法。我使用的是WSL2上的Ubuntu 20.04系统。

sudo apt remove git -y
sudo apt update && sudo apt upgrade

DEBIAN_FRONTEND=noninteractive

sudo apt install build-essential autoconf dh-autoreconf libcurl4-openssl-dev \
                 tcl-dev gettext asciidoc docbook2x install-info \
                 libexpat1-dev libz-dev -y

wget https://raw.githubusercontent.com/paul-nelson-baker/git-openssl-shellscript/master/compile-git-with-openssl.sh .

./compile-git-with-openssl.sh -skiptests

最终这个问题被解决了,谢谢!我使用了 bash compile-git-with-openssl.sh -skiptests 命令来运行。 - DataBach
该脚本使用“make install”而没有包管理。如果需要,请手动删除所有安装的文件。熟悉Ubuntu 22.04。 - dimplex
这在我的WSL2 Ubuntu 20.04上运行良好。 - YK Tan

7

对于在Windows 10 WSL2中可能遇到以下问题的任何人,可以通过以下参考修复:

fakeroot, while creating message channels: Function not implemented
This may be due to a lack of SYSV IPC support. 

https://github.com/microsoft/WSL/issues/2465#issuecomment-377583291

sudo update-alternatives --set fakeroot /usr/bin/fakeroot-tcp

谢谢,伙计。这个命令对我有效:sudo update-alternatives --set fakeroot /usr/bin/fakeroot-tcp - newcomers

2
我在这里找到了解决方法:https://stdworkflow.com/652/error-rpc-failed-curl-56-gnutls-recv-error-110-the-tls-connection-was-non-properly-terminated,以下是作者的答案:
问题似乎是 Ubuntu gnutls_handshake 出现的问题。
解决方法:
重新编译 git
使用 libcurl-openssl-dev 来替换 gnutls
安装必要的依赖和环境
sudo apt-get install build-essential fakeroot dpkg-dev

如果你正在使用树莓派,可能会遇到本地化问题,无法设置本地化,只需记得将 export LC_ALL=C 放入 .bashrc 文件中,并重新启动。

创建一个目录来放置新编译的 Git。

mkdir ~/git-rectify

获取Git源代码
cd ~/git-rectify
sudo apt-get source git

安装git依赖项

sudo apt-get build-dep git

安装libcurl

sudo apt-get install libcurl4-openssl-dev

进入Git目录,目录名称取决于您安装的版本

cd git-2.7.4/

修改两个文件后重新编译git

vim ./debian/control # Modify libcurl4-gnutls-dev to libcurl4-openssl-dev
vim ./debian/rules # delete the entire line of TEST=test
sudo dpkg-buildpackage -rfakeroot -b

回到上一个目录并安装已编译的安装包。
cd .. # is in the ~/git-rectify directory
sudo dpkg -i git_2.7.4-0ubuntu0.4_amd64.deb

源代码安装Git 这里记录了从源代码安装Git的步骤。

git clone https://github.com/git/git.git

切换到相应的版本标签

git checkout -b v2.22.0
sudo apt-get install libssl-dev

根据文档中描述的安装命令进行安装。


2

当我通过Visual Studio和Ubuntu 18.04的WSL运行CMake时,我发现了另一种解决此问题的方法。 我在这里找到了升级GIT到最新版本的另一种方法:https://itsfoss.com/install-git-ubuntu/

sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt install git

即使我们升级后仍然遇到GnuTLS recv错误(-110),但GIT操作不再失败。


1

那么如何解决这个问题呢?

通过检查这些错误是否在接下来的几个小时内持续存在。

GitHub状态目前报告:

我们正在调查错误率升高的报告。

这可能是他们问题的副作用。

另一种方法是确保您正在使用最新的Git版本,OP通过重新编译Git实现了这一点。


2
谢谢您的回答,我通过重新编译和安装 Git 解决了这个问题。 - G.yx

0

由于某些原因,“git pull”一直给出这个消息,但“git pull origin master”可以正常工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接