繁体   English   中英

Git,致命:无法访问“https://github.com/path/to/repo.git”:gnutls_handshake() 失败:pull 函数出错

[英]Git, fatal: unable to access 'https://github.com/path/to/repo.git': gnutls_handshake() failed: Error in the pull function

  • 操作系统:Windows VirtualBox 中的 Ubuntu 18.04.1(斯坦福 CS144 实验室 VM)(我不是斯坦福学生做作业,只是为了好玩)
  • Git 版本:2.32.0

当我运行这个: $ git push -u origin master

我收到一个错误: > fatal: unable to access 'https://github.com/path/to/repo/': gnutls_handshake() failed: Error in the pull function.

我已经尝试了此页面中的方法,但没有奏效。

上述链接中的方法之一:

$ mkdir ~/git-rectify
$ cd ~/git-rectify
$ sudo apt-get source git
$ sudo apt-get update
$ apt-get source git
$ sudo apt-get build-dep git
$ sudo apt-get install libcurl4-openssl-dev
$ dpkg-source -x git_x.x.x-1ubuntu0.1
$ sudo dpkg-buildpackage -rfakeroot -b
$ sudo dpkg -i git_x.x.x.x-1_amd64.deb

我跑了第六行: $ sudo apt-get build-dep git

运行后,我收到错误:

Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 builddeps:git : Depends: gettext but it is not installable
                 Depends: libpcre3-dev but it is not installable
                 Depends: libcurl4-gnutls-dev but it is not installable
                 Depends: libexpat1-dev but it is not installable
                 Depends: subversion but it is not installable
                 Depends: libsvn-perl but it is not installable
                 Depends: libyaml-perl but it is not installable
                 Depends: tcl but it is not installable
                 Depends: libcgi-pm-perl but it is not installable
                 Depends: libmailtools-perl but it is not installable
                 Depends: cvs but it is not installable
                 Depends: cvsps but it is not installable
                 Depends: libdbd-sqlite3-perl but it is not installable
                 Depends: libio-pty-perl but it is not installable
                 Depends: debhelper (>= 9) but it is not installable
                 Depends: dh-exec (>= 0.7) but it is not installable
                 Depends: dh-apache2 but it is not installable
                 Depends: asciidoc (>= 8.6.10) but it is not installable
                 Depends: xmlto but it is not installable
                 Depends: docbook-xsl but it is not installable
E: Unable to correct problems, you have held broken packages.

你的 sources.list 配置错误,编辑你的/etc/apt/sources.list如下:

deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse 
deb http://us.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse 
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ bionic partner

deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse 
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse 
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse  
deb-src http://archive.canonical.com/ubuntu/ bionic partner

然后运行:

sudo apt update
sudo apt upgrade
sudo apt-get build-dep git

最近,当我从 GitHub 克隆任何 repo 或创建任何新 repo 时,我遇到了这个问题。 在我推送更改或将我的新工作存储库推送到 GitHub 时在存储库中工作后,我收到此错误。 我认为当你的 GitHub 帐户没有在你的 Linux 机器上全局配置时,就会发生这种情况。

您可以使用$ git push -u origin master --force这对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM