简体   繁体   English

Git 拉取失败:调用失败来自服务器的文件意外结束

[英]Git Pull Failed: Invocation failed Unexpected end of file from server

I'm trying to execute a git pull using Android Studio's built-in button, but it fails with this message:我正在尝试使用 Android Studio 的内置按钮执行git pull取,但失败并显示以下消息:

Git Pull Failed
                Invocation failed Unexpected end of file from server
                java.lang.RuntimeException: Invocation failed Unexpected end of file from server
                at org.jetbrains.git4idea.http.GitAskPassXmlRpcClient.askUsername(GitAskPassXmlRpcClient.java:55)
                at org.jetbrains.git4idea.http.GitAskPassApp.main(GitAskPassApp.java:66)
                Caused by: java.net.SocketException: Unexpected end of file from server
                at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
                at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
                at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:848)
                at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
                at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
                at org.apache.xmlrpc.DefaultXmlRpcTransport.sendXmlRpc(DefaultXmlRpcTransport.java:87)
                at org.apache.xmlrpc.XmlRpcClientWorker.execu... (show balloon)

What are the reasons this could be failing?这可能失败的原因是什么?

You can enable "Use credential helper" in Preferences - Version Control - Git您可以在 Preferences - Version Control - Git 中启用“Use credential helper”

If someone is facing this issue in Android Studio BumbleBee, Do the following thing.如果有人在 Android Studio BumbleBee 中遇到此问题,请执行以下操作。 Hopefully it will solve your problem希望它能解决你的问题

Preference -> Git -> Check Use credential helper if not checked Preference -> Git -> Check Use credential helper if not check

On Android Studio "ChipMunk" got this problem在 Android Studio "ChipMunk" 上遇到了这个问题

  • File -> Settings -> Version Control -> Git -> Use credential helper (set check) -> push Apply button文件 -> 设置 -> 版本控制 -> Git -> 使用凭证助手(设置检查) -> 按应用按钮

Resolved the issue, PS : I use token for access解决了这个问题,PS:我使用令牌进行访问

The error originates from the Android Studio canary.该错误源于 Android Studio canary。 You can either update your Android Studio or you can use the inbuilt terminal below and type:您可以更新 Android Studio,也可以使用下面的内置终端并输入:

$ git pull

If anyone has this problem in Android Studio BumbleBee just open the android studio terminal and type如果有人在 Android Studio BumbleBee 中遇到此问题,只需打开 android 工作室终端并输入

git pull

and enter the git password.并输入 git 密码。

Now, you can push and pull in version control现在,您可以推送和拉入版本控制

Finally, this worked for me:最后,这对我有用:

  1. Open Terminal in Android Studio.在 Android Studio 中打开终端。 Hit this command:打这个命令:

     git config credential.helper store

It will ask for a password, enter your password.它会要求输入密码,输入您的密码。

  1. Enable "Use Credential Helper" in Settings -> Version Control -> Git.在设置 -> 版本控制 -> Git 中启用“使用凭据助手”。

After these 2 steps, you will be able to Pull, Push, Commit.在这两个步骤之后,您将能够拉、推、提交。

For anyone using Chipmunk version, here are the steps I used to fix this issue:对于使用 Chipmunk 版本的任何人,以下是我用来解决此问题的步骤:

  1. Upgrade git to latest version升级git到最新版本
  2. Check credential helper in setting -> Version control -> Git检查设置中的凭证助手 -> 版本控制 -> Git

Hope it helps.希望能帮助到你。

I tried all the suggestion did not work me.我尝试了所有建议对我不起作用。

What worked was Settings -> Version Control -> Github -> Remove your accound and log in again with new token.有效的是设置 -> 版本控制 -> Github -> 删除您的帐户并使用新令牌再次登录。

I am using chipmunk我正在使用花栗鼠

For those using chipmunk android studio File -> Settings -> Version Control -> Git -> Use credential helper (set check) and apply对于那些使用花栗鼠 android 工作室文件 -> 设置 -> 版本控制 -> Git -> 使用凭证助手(设置检查)并应用的人

I'm using Android Studio Chipmunk and all I had to do is enabling "Use credential helper" in preference and use terminal to pull我正在使用 Android Studio Chipmunk,我所要做的就是优先启用“使用凭证助手”并使用终端拉

git pull

then enter Github username and access token instead of password然后输入 Github 用户名和访问令牌而不是密码

I faced same issue, I tried "Use credential helper" not worked, and deleted.gitconfig file in C://User folder not worked, after so much struggle,我遇到了同样的问题,我尝试了“使用凭证助手”不起作用,并删除了 C://User 文件夹中的 .gitconfig 文件,经过这么多的努力,

Fianlly Installed Android Studio Dolphin (2021.3.1) Canary 1, from this link Android Studio download archives最终安装 Android Studio Dolphin (2021.3.1) Canary 1,从此链接Android Studio 下载档案

After install, when it asked to import prvious version setting.安装后,当它要求导入以前的版本设置时。 I selected Do not import.我选择了不导入。

Resolved the issue.解决了这个问题。

Use these steps to git over HTTPS not SSH:在 HTTPS 而不是 SSH 上对 git 使用这些步骤:

git config credential.helper store

You'll be requested the credentials username/token or pass.您将被要求提供凭据用户名/令牌或通过。 Check this in Preferences > GIT > Use Credential Helper在 Preferences > GIT > Use Credential Helper 中检查此项

Just restart Android Studio.只需重启 Android Studio。

I ran into the same issue today.我今天遇到了同样的问题。 I was logging in with social login and didn't have a password.我用社交登录登录,没有密码。

Get an App Password on Bitbucket,在 Bitbucket 上获取App Password

  • Setting -> Personal Settings -> Add Password -> Create App Password设置 -> 个人设置 -> 添加密码 -> 创建应用密码
  • Copy Password复制密码

Then on Android Studio然后在 Android Studio

  • $git pull on Android Studio's Terminal section (or another terminal like macOS terminal) $git pull Android Studio 的终端部分(或其他终端,如 macOS 终端)
  • It will ask you for the password, enter the password you copied before它会要求您输入密码,输入您之前复制的密码
  • Check Use Credential Helper in Preferences -> Version Control -> Git在首选项 -> 版本控制 -> Git 中检查Use Credential Helper

Following steps:以下步骤:

Delete.gradle and.idea删除.gradle和.idea

Delete remote URL from git tab从 git 选项卡中删除远程 URL

go to git in android studio prefs and select use credential manager go 到 git 在 android 工作室首选项和 Z99938282F04071859941E18F16EF4 中使用凭证管理器

Now add your remote URL in the git tab again and "FETCH"现在再次在 git 选项卡中添加您的远程 URL 和“FETCH”

use terminal enter使用终端输入

git clone https://git-example-service/project-url.git

then Then you will be prompted Enter account password然后会提示输入账号密码

Resolved the issue.解决了这个问题。

For those of you, who are using linux and android studio chipmunk 2021.2.1 Patch 1. I faced this problem and most of the solution is not working.对于那些正在使用 linux 和 android studio chipmunk 2021.2.1 补丁 1 的人。我遇到了这个问题,大多数解决方案都不起作用。

  1. File -> Settings -> Version Control -> Git -> check Use credential helper then push, not working.文件 -> 设置 -> 版本控制 -> Git -> 选中使用凭证助手然后推送,不工作。

  2. git pull add username and password then push, not working. git pull 添加用户名和密码然后推送,不工作。 add username and token then push, not working.添加用户名和令牌然后推送,不工作。

  3. git config credential.helper store then push, not working. git config credential.helper 存储然后推送,不工作。

  4. remove account, sign in again then push not working.删除帐户,再次登录,然后推送不起作用。

  5. update the git the latest version.更新git最新版本。 repeat the first step.重复第一步。 It's work.这是工作。

I tried File -> Settings ->Version Control -> Git -> Check Use credential helper , but it didn't helped for Android Studio Chipmunk - 2021.2.1 Patch 1.我尝试File -> Settings ->Version Control -> Git -> Check Use credential helper ,但它对 Android Studio Chipmunk - 2021.2.1 补丁 1 没有帮助。

But this answer helped - refer answer但是这个答案有帮助 -参考答案

if Using credential helper settings will not work for you then please try to update your android studio version.如果使用凭证助手设置对您不起作用,请尝试更新您的 android 工作室版本。 it will definitely work for you.它肯定会为你工作。

If you are experiencing this issue when trying to push, use this command terminal, the easiest is the terminal right in the android studio.如果您在尝试推送时遇到此问题,请使用此命令终端,最简单的是 android 工作室中的终端。

git push

File -> Settings -> Version Control -> Git -> Use credential helper (set it to checked).文件 -> 设置 -> 版本控制 -> Git -> 使用凭证助手(将其设置为选中)。 Then git pull after then git push然后 git 拉后 git 推

File -> Invalidate Caches...文件 -> 使缓存无效...

Check "Clear VCS Log caches and indexes" box选中“清除 VCS 日志缓存和索引”框

Click "Invalidate and Restart"单击“无效并重新启动”

In case 'Credential Helper' failed, Try: File -> Invalidate Caches如果“凭据助手”失败,请尝试:文件 -> 使缓存无效

File -> Invalidate caches -> Invalidate and restart

And restart your machinerestart您的机器

git init
git remote add origin LINK_HTTPS_ON_GIT
git add .
git commit -m "NhoPV BackUp"
git fetch

Login登录

git push origin YOUR_BRANCH

I also had this problem with Bitbucket repository.我在 Bitbucket 存储库中也遇到了这个问题。

My solution is:我的解决方案是:

  1. "Use credential helper" in Preferences -> Version Control -> Git首选项 -> 版本控制 -> Git 中的“使用凭证助手”
  2. Go to Bitbucket: Account -> Personal Settings -> App passwords. Go 至 Bitbucket:账户 -> 个人设置 -> 应用密码。 Create app password.创建应用密码。

Then use your generated app password instead of account password.然后使用您生成的应用程序密码而不是帐户密码。 Now plugin works well.现在插件运行良好。

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

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