90

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 15

192

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

This Issue can be caused by various other problems, notably: Outdated/Corrupted /AppData/Local/Google/AndroidStudio2021.2/tmp/intellij-git-askpass-local.sh or by extension an outdate git-windows or Linux equivalent and relative new android studio bug relating to GitHub starting to enforece it's no password policy. Invalidating caches and removing the sh-file might help you to determine your exact problem as the error message may change to something more usefull. Also see here: stackoverflow.com/questions/68781928/…
Inconceivable that the companies have one trillion dollars and cannot make git clone work for paying customers. They must have corrupted their software on purpose, to sell more support....
59

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

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

6 Comments

May be you are using Mac, for windows where is the credential helper?
This is not working
When I do this I then get presented with a Github login dialog. But I have already installed a token and Github no longer supports username/password auth.
This is, in essence, the same answer as the one from Aengus from Dec 2021 ("enable use credential helper")
This does not work.
|
47

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.

1 Comment

This worked for me after restarting Android Studio
19

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.

1 Comment

Update Android Studio does not help since this occurred for me on latest stable Android Studio Bumblebee. The correct answer is to enable credential helper setting.
10

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.

2 Comments

for me 2nd option was enough. Only then after Manage Remotes had succeed with push
This is the only one solution for me. Each time I have the issue (I can't understand but without notice I have this issue) perform this solution: git config credential.helper store and all returns working perfect. Thanks so very much for this.
7

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

Then I logged in again with a new token.

Comments

7

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

Comments

2

File -> Invalidate Caches...

Check "Clear VCS Log caches and indexes" box

Click "Invalidate and Restart"

1 Comment

I first ticked the "Use credential helper" checkbox under Settings. This helped to push once or twice. But the error came back. Your suggestion seems to have solved the issue. Thanks.
1

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.

Comments

1

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.

Comments

0

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"

1 Comment

How does this differ from the existing answers that say to use the credential manager?
0

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.

Comments

0

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

Comments

0
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

Comments

0

I also had this problem with Bitbucket repository.

My solution is:

  1. "Use credential helper" in Preferences -> Version Control -> Git
  2. Go to Bitbucket: Account -> Personal Settings -> App passwords. Create app password.

Then use your generated app password instead of account password. Now plugin works well.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.