89

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?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Andras Sanislo
  • 1,209
  • 1
  • 9
  • 20

15 Answers15

192

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

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

TylerH
  • 20,799
  • 66
  • 75
  • 101
Aengus
  • 2,131
  • 2
  • 5
  • 9
  • 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: https://stackoverflow.com/questions/68781928/support-for-password-authentication-was-removed-on-august-13-2021 – Sheppy Sep 24 '22 at 04:18
  • 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.... – Niklas Rosencrantz Dec 22 '22 at 10:11
59

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

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

TylerH
  • 20,799
  • 66
  • 75
  • 101
Aminul Haque Aome
  • 2,261
  • 21
  • 34
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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
RocqJones
  • 273
  • 4
  • 9
  • 7
    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. – Carl B Jan 27 '22 at 09:47
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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Kishan Solanki
  • 13,761
  • 4
  • 85
  • 82
  • for me 2nd option was enough. Only then after `Manage Remotes` had succeed with push – CodeToLife May 04 '22 at 19:59
  • 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. – CNK Sep 20 '22 at 20:56
7

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

Then I logged in again with a new token.

TylerH
  • 20,799
  • 66
  • 75
  • 101
7

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

Deniz Babat
  • 205
  • 2
  • 6
2

File -> Invalidate Caches...

Check "Clear VCS Log caches and indexes" box

Click "Invalidate and Restart"

Kirill Kitten
  • 1,759
  • 1
  • 4
  • 5
  • 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. – Hmerman6006 Aug 24 '22 at 12:12
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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
praveenb
  • 10,549
  • 14
  • 61
  • 83
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.

Raj008
  • 3,539
  • 2
  • 28
  • 26
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"

imansdn
  • 968
  • 1
  • 7
  • 17
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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
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

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
Mr N
  • 25
  • 1
  • 3
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.

Dr. Failov
  • 311
  • 4
  • 7