简体   繁体   English

如何解决“git pull,fatal: unable to access 'https://github.com...\': Empty reply from server”

[英]How to resolve "git pull,fatal: unable to access 'https://github.com...\': Empty reply from server"

It's failed when I used Git command "git pull" to update my repository, messages as below: fatal: unable to access '...': Empty reply from server.当我使用 Git 命令“git pull”更新我的存储库时失败,消息如下:fatal: unable to access '...': Empty reply from server.

And the I tried to use the GitHub App, but alert this:我尝试使用 GitHub 应用程序,但请注意:

Cloning into 'renren_mobile'...
warning: templates not found /Applications/GitHub.app/Contents/Resources/git/templates
2014-11-23 13:58:57.975 GitHub for Mac Login[659:11891] AskPass with arguments: (
    "/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
    "Username for 'https://github.com': "
)
2014-11-23 13:58:58.032 GitHub for Mac Login[660:11915] AskPass with arguments: (
    "/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
    "Password for '': "
)
fatal: unable to access '...': Empty reply from server
 (128)

I resolved this problem.我解决了这个问题。 I think it happened maybe because of https but I am not very sure.我认为这可能是因为 https,但我不太确定。 You can Switch remote URLs from HTTPS to SSH.您可以将远程 URL 从 HTTPS 切换到 SSH。

1.Pls refer to this link for details: https://help.github.com/articles/changing-a-remote-s-url/ 1.详情请参考此链接: https ://help.github.com/articles/changed-a-remote-s-url/

Also I had to config the ssh key.我还必须配置 ssh 密钥。

2.Follow this: https://help.github.com/articles/generating-ssh-keys/ 2.按照这个: https ://help.github.com/articles/generating-ssh-keys/

I came across this problem because I replaced my mac, but I do the transfer of data,I think it is probably because the key reasons.我遇到这个问题是因为我更换了我的mac,但我做了数据传输,我认为可能是关键原因。

I was stuck in this problem until I noticed that I was not logged into my VPN.我一直被这个问题困扰,直到我注意到我没有登录到我的 VPN。

  1. If you have configured your proxy for a VPN, you need to login to your VPN to use the proxy.如果您为 VPN 配置了代理,则需要登录到您的 VPN 才能使用代理。

  2. to use it outside the VPN use the unset command:要在 VPN 之外使用它,请使用 unset 命令:

     git config --global --unset http.proxy

And remember to set the proxy when within the VPN.并记住在 VPN 内设置代理。

On Windows:在 Windows 上:

Go to Win -> Control Panel -> Credential Manager -> Windows Credentials转到 Win -> 控制面板 -> 凭据管理器 -> Windows 凭据

Search for github address and remove it.搜索github地址并删除。

在此处输入图片说明

Then try to execute:然后尝试执行:

git push -u origin master

Windows will ask for your git credentials again, put the right ones and that's it. Windows 将再次询问您的 git 凭据,输入正确的凭据,仅此而已。

I tried a few of the tricks listed here without any luck.我尝试了这里列出的一些技巧,但没有任何运气。 Looks like something was getting cached by my terminal emulator (iTerm2) or session.看起来我的终端模拟器 (iTerm2) 或会话缓存了一些东西。 The issue went away when I ran the command from a fresh terminal tab.当我从新的终端选项卡运行命令时,问题就消失了。

If unsetting using如果取消设置使用

git config --global --unset-all https.proxy

doesn't work for you .不适合你。

Then check if the environment variable http_proxy and https_proxy are set .然后检查是否设置了环境变量http_proxyhttps_proxy Check using this command : -使用此命令检查: -

env | grep -i proxy

If this variable is set to something , then you can just unset it using :-如果此变量设置为 something ,那么您可以使用以下方法取消设置:-

   https_proxy=""

Try, this尝试这个

git config --global --unset http.proxy git config --global --unset http.proxy

git config --global --unset https.proxy git config --global --unset https.proxy

I solved such a problem by replacing https part of my remote origin with http.我通过用 http 替换远程源的 https 部分解决了这个问题。 It is also a workaround.这也是一种解决方法。 I think it may help someone in the future.我认为这可能会在将来对某人有所帮助。

I had tried most of the answers here but didn't manage to resolve the issue (on Windows 10).我在这里尝试了大部分答案,但未能解决问题(在 Windows 10 上)。

What resolved the problem was simply to upgrade version from git version 2.8.1.windows.1 to the latest version git version 2.10.1.windows.1解决问题的方法只是将版本从git version 2.8.1.windows.1升级到最新版本git version 2.10.1.windows.1

I think the solution mentioned above to remove the git credentials from windows credentials manager works.我认为上面提到的从 Windows 凭据管理器中删除 git 凭据的解决方案有效。 Basically it would have sourced with other git credentials in the cache.基本上它会从缓存中的其他 git 凭据中获取。 Flushing out the old ones would pave way to override the new credentials.清除旧凭据将为覆盖新凭据铺平道路。

The error may be, the computer has saved a git username and password so if you shift to another account the error 403 will appear.错误可能是,计算机已经保存了 git 用户名和密码,因此如果您切换到另一个帐户,则会出现错误 403。 Below is the solution下面是解决方案

In Windows在 Windows 中

you can find the keys here:你可以在这里找到钥匙:

control panel > user accounts > credential manager > Windows credentials > Generic credentials控制面板 > 用户帐户 > 凭据管理器 > Windows 凭据 > 通用凭据

Next, remove the Github keys.接下来,删除 Github 密钥。

In mac在 Mac 上

In Finder, search for the Keychain Access app > In Keychain Access, search for github.com > Find the "internet password" entry for github.com > Edit or delete the entry accordingly.在 Finder 中,搜索 Keychain Access 应用程序 > 在 Keychain Access 中,搜索 github.com > 找到 github.com 的“互联网密码”条目 > 相应地编辑或删除该条目。

I had the same problem however, with a Jenkins installation.但是,我在安装 Jenkins 时遇到了同样的问题。 The response back from trying to clone was always:尝试克隆的响应始终是:

stderr: fatal: unable to access 'https://my.gitlab.server/group/repo.git/': Empty reply from server

Unfortunately switching to http wasn't an option, so I needed the root cause.不幸的是,切换到 http 不是一种选择,所以我需要根本原因。 Turns out there was a http setting in the global config for the Jenkins user (likely added when we were running a self-signed cert on out gitlab instance).事实证明,Jenkins 用户的全局配置中有一个 http 设置(可能是在我们在 gitlab 实例上运行自签名证书时添加的)。 Taking look at the global config:查看全局配置:

$ git config --global -l
http.sslverify=false

Removing this did the trick删除这个就行了

$ git config --global --unset http.sslverify

(It also looks like this is a typo, with the correct key http.sslVerify ) (看起来这是一个错字,使用正确的密钥http.sslVerify

You can try for following solutions step by step one of them should work for you.您可以逐步尝试以下解决方案,其中之一应该适合您。

I have tried all three steps but STEP 4 worked for me.我已经尝试了所有三个步骤,但STEP 4对我有用。 Because I was using two different git accounts因为我使用了两个不同的 git 帐户

STEP 1:第1步:

STEP 2第2步

  • Check your current branch git branch if you are not on branch git checkout branch_name .如果您不在分支git checkout branch_name上,请检查您当前的分支git branch

  • To create new branch use git checkout -b "new branch name" to switch on new branch use above command要创建新分支,请使用git checkout -b "new branch name"打开新分支,使用上述命令

STEP 3第 3 步

  • In the special case that you are creating a new repository starting from an old repository that you used as a template (Don't do this if this is not your case).在特殊情况下,您要从用作模板的旧存储库开始创建新存储库(如果不是这种情况,请不要这样做)。 Completely erase the git files of the old repository so you can start a new one:完全擦除旧存储库的 git 文件,以便您可以开始一个新存储库:

    rm -rf .git and repeat STEP 1 rm -rf .git并重复步骤 1

STEP 4第四步

  • On windows, you can try putting write credentials or remove git credentials from the control panel by following way and repeat STEP 1在 Windows 上,您可以尝试通过以下方式从控制面板中放置写入凭据或删除 git 凭据并重复步骤 1

    Go to Win -> Control Panel -> Credential Manager -> Windows Credentials转到 Win -> 控制面板 -> 凭据管理器 -> Windows 凭据

在此处输入图片说明

I received the same error in pushing files to my private bitbucket repository.我在将文件推送到我的私人 bitbucket 存储库时收到了同样的错误。 For some odd reasons, the request couldn't be sent and an empty reply was the result!由于一些奇怪的原因,请求无法发送,结果是一个空的回复! I tried again with a proxy tunnel (you can use any other VPN applications) and it has been solved till now.我再次尝试使用代理隧道(您可以使用任何其他 VPN 应用程序),直到现在它已经解决了。

If you're on Mac and using a terminal emulator such as iTerm2 and if it's not giving any response then it could be that the files you're trying to pull into your project could be large and this could be taking time. 如果您使用的是Mac,并且使用的是终端仿真器(例如iTerm2),并且未给出任何响应,则可能是您尝试拉入项目的文件可能很大,这可能会花费一些时间。 It seems that for some reason terminal emulators are taking more time than if done in Terminal. 似乎由于某种原因,终端仿真器比在终端仿真器中花费的时间更多。 So try to execute the command in terminal and this could work. 因此,尝试在终端中执行命令,这可能会起作用。

For Ubuntu-like distro with your own git compiled: you might be missing libcurl4-openssl-dev .对于编译了自己的 git 的类似 Ubuntu 的发行版:您可能缺少libcurl4-openssl-dev apt install libcurl4-openssl-dev then reconfigure, then make install apt install libcurl4-openssl-dev然后重新配置,然后进行安装

如果您使用代理,您可以解决此问题

We have an internally hosted git server (TFS) and I have Proxy environment variables set (HTTP_PROXY and HTTPS_PROXY).我们有一个内部托管的 git 服务器 (TFS),我设置了代理环境变量(HTTP_PROXY 和 HTTPS_PROXY)。 After having been working fine for some time, I suddenly started getting this error.在正常工作一段时间后,我突然开始收到此错误。

I ended up fixing it by setting our server in the NO_PROXY environment variable.我最终通过在NO_PROXY环境变量中设置我们的服务器来修复它。

在此处输入图片说明

I guess that your git remote url has been set as SSH.我猜您的 git remote url 已设置为 SSH。 You can set it as HTTPS:您可以将其设置为 HTTPS:

git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git

Retry this command and there is prompt to enter username and password:重试这个命令,会提示输入用户名和密码:

git pull

I was also facing the same issue But my issue was due to wrong credentials stored in my keyChain.我也面临同样的问题但我的问题是由于存储在我的 keyChain 中的凭据错误。 So I solved by removing my old credentials from my keychain.所以我通过从我的钥匙串中删除我的旧凭据来解决。

Replacing my remote from https to git worked for me.将我的遥控器从 https 替换为 git 对我有用。

Steps I followed can be found here可以在此处找到我遵循的步骤

Finally, you can push your changes using git push -u origin <current_working_branch>最后,您可以使用git push -u origin <current_working_branch>推送更改

VS Code VS代码

  • CMD+Shift+P -> Developer: Reload Window CMD+Shift+P -> 开发人员:重新加载窗口

This is worked for me.这对我有用。 You can try this command你可以试试这个命令

我解决了,用 'ssh..' 替换 'http..' git url 简单打开 .git/config 文件并将其复制到那里

暂无
暂无

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

相关问题 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 致命:无法访问“ https://github.com/CocoaPods/Specs.git/”:无法解析代理:proxy-listen-ip - fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': Could not resolve proxy: proxy-listen-ip 我该如何解决致命问题:无法访问“https://github.com/MTaha57/Build-Portfolio-.git/”:请求的 URL 返回错误:403 - How can i resolve fatal: unable to access 'https://github.com/MTaha57/Build-Portfolio-.git/': The requested URL returned error: 403 无法安装 pod(致命:无法访问 &#39;https://github.com/CocoaPods/Specs.git/&#39;) - Cannot install a pod (fatal: unable to access 'https://github.com/CocoaPods/Specs.git/') 致命:无法访问“ https://github.com/MyName/MyRepo.git/”:请求的URL返回错误:403 - fatal: unable to access 'https://github.com/MyName/MyRepo.git/': The requested URL returned error: 403 推送失败:无法访问“ https://github.com/abc/xyz.git/”:无法解析主机:github.com - Push failed: unable to access 'https://github.com/abc/xyz.git/': Could not resolve host: github.com 致命:无法访问“https://github.com/usename/my-project.git/”:请求的 URL 返回错误:403 Mac - fatal: unable to access 'https://github.com/usename/my-project.git/': The requested URL returned error: 403 Mac 致命:无法访问“https://github.com/gabelerner/canvg.git/”:对等报告不兼容或不受支持的协议版本 - fatal: unable to access 'https://github.com/gabelerner/canvg.git/': Peer reports incompatible or unsupported protocol version remote:拒绝XXX / .git的权限给YYY。 致命:无法访问“ https://github.com/XXX//”:请求的URL返回错误:403 - remote: Permission to XXX/.git denied to YYY. fatal: unable to access 'https://github.com/XXX//': The requested URL returned error: 403 致命:无法访问“https://github.com/SOME_NAME/SOME_PROJECT.git/”:请求的网址返回错误:403 - fatal: unable to access 'https://github.com/SOME_NAME/SOME_PROJECT.git/': The requested URL returned error: 403
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM