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

Viewed 41889

I'm trying to execute a git pull using Android Studio's built-in button, but it fails with this message:

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?

15 Answers

You can enable the option "Use credential helper" in Android Studio's Preferences menu.

The option is located at Preferences -> Version Control -> Git

If someone is facing this issue in Android Studio Preview, do the following:

Preference -> Git -> Check Use credential helper (if not checked)

This resolved the problem for me:

File -> Settings -> Version Control -> Git -> Use credential helper (set it to checked) -> push the Apply button.

P.S. I use a token for access.

The error originates from the Android Studio Preview version (Bumblebee, Chipmunk, etc.). You can either update your Android Studio to a newer version, or you can use the inbuilt terminal and type the command below:

$ git pull

You may be prompted to re-enter a password or token.

If anyone has this problem in Android Studio BumbleBee just open the android studio terminal and type

git pull

and enter the git password.

Now, you can push and pull in version control

This worked for me:

  1. Open Terminal in Android Studio. Hit this command:

    git config credential.helper store
    

    It will ask for a password, enter your password. This could also be an access token.

  2. Enable "Use Credential Helper" in Settings -> Version Control -> Git.

After these 2 steps, you will be able to Pull, Push, and Commit.

What worked for me was going to Settings -> Version Control -> GitHub -> Remove your account

Then I logged in again with a new token.

File -> Settings -> Version Control -> Git -> Use credential helper (set it to checked). Then git pull after then git push

File -> Invalidate Caches...

Check "Clear VCS Log caches and indexes" box

Click "Invalidate and Restart"

Using the credential helper did not work for me, and neither did deleting the .gitconfig file in my C:\User folder.

What worked for me was installing a new version of Android Studio, and opted out of importing previous version settings.

Use these steps to git over HTTPS not SSH:

git config credential.helper store

You'll be requested the credentials username/token or pass. Check this in Preferences > GIT > Use Credential Helper

Just restart Android Studio.

Following steps:

Delete .gradle and .idea

Delete remote URL from git tab

go to git in android studio prefs and select use credential manager

Now add your remote URL in the git tab again and "FETCH"

Using the terminal, type this

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

Then you will be prompted to enter your account password. Once you enter your password, the issue should be resolved.

In Ubuntu, 'Credential Helper' AND 'File -> Invalidate Caches' not helped me, I just DELETED the FILE '/home/YOUR USERNAME/.cache/Google/AndroidStudio2021.2/tmp/intellij-git-askpass-local.sh'. now its working

File -> Invalidate caches -> Invalidate and restart

And restart your machine

Related