简体   繁体   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

  • OS: Ubuntu 18.04.1 in a windows VirtualBox (the Stanford CS144 lab VM) (and I am not a Stanford student doing homework, just for fun)操作系统:Windows VirtualBox 中的 Ubuntu 18.04.1(斯坦福 CS144 实验室 VM)(我不是斯坦福学生做作业,只是为了好玩)
  • Git Version: 2.32.0 Git 版本:2.32.0

And when I run this: $ git push -u origin master当我运行这个: $ git push -u origin master

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

I have tried the methods from this page , and it didn't work out. 我已经尝试了此页面中的方法,但没有奏效。

One of the methods in the above link:上述链接中的方法之一:

$ 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

I ran the sixth line: $ sudo apt-get build-dep git我跑了第六行: $ sudo apt-get build-dep git

After running, I got the error:运行后,我收到错误:

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.

You sources.list is misconfigured, edit your /etc/apt/sources.list as follows:你的 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

Then run:然后运行:

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

Recently I have faced this problem when I clone any repo from GitHub or create any new repo.最近,当我从 GitHub 克隆任何 repo 或创建任何新 repo 时,我遇到了这个问题。 After working in the repo when I push my changes or going to push my new work repo to GitHub I get this error.在我推送更改或将我的新工作存储库推送到 GitHub 时在存储库中工作后,我收到此错误。 I think this happens when your GitHub account is not configured globally with your Linux machine.我认为当你的 GitHub 帐户没有在你的 Linux 机器上全局配置时,就会发生这种情况。

You can use $ git push -u origin master --force this worked for me.您可以使用$ git push -u origin master --force这对我有用。

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

相关问题 gnutls_handshake() 失败:GIT 握手失败 - gnutls_handshake() failed: Handshake failed GIT git push错误:无法读取“ https://github.com”的用户名:权限被拒绝 - git push error: could not read Username for 'https://github.com': Permission denied docker 内部出现致命错误:无法访问<url>无法解析主机:github.com</url> - Inside docker got error as fatal: unable to access <url> Could not resolve host: github.com 致命:内存不足,在 Ubuntu VM 上的 git pull 上 malloc 失败错误 - fatal: Out of memory, malloc failed error on git pull on Ubuntu VM 错误:未能将一些引用推送到 &#39;git@github.com:<name> /<project> .git&#39; - error: failed to push some refs to 'git@github.com:<name>/<project>.git' 在Beaglebone上安装git和配置github时出现SSL / https错误 - SSL/https error when Installing git and configuring github on Beaglebone git clone GnuTLS recv error(-9):收到意外长度的TLS数据包 - git clone GnuTLS recv error (-9): A TLS packet with unexpected length was received 为什么从github仓库通过https的“ git pull”命令需要“ sudo”作为前缀? - Why “git pull” command over https from github repository need “sudo” as prefix? Git-将Github仓库与本地仓库同步吗? - Git - Syncing a Github repo with a local one? Kali Linux“无法解析主机github.com”错误 - Kali linux “could not resolve host github.com” error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM