Android Studio - Push failed: fatal: Could not read from remote repository

前端 未结 12 1131
醉酒成梦
醉酒成梦 2021-01-31 07:26

I have a git project at Android Studio and a remote at BitBucket and I changed it to use SSH instead of HTTPS. I can make everything work using Atlassian\'s SourceTree, but in A

相关标签:
12条回答
  • 2021-01-31 07:56

    Got the issue after switching to Android Studio 3.6 when under the hood it was bumped to IDEA 2019

    In my case below solution worked out of the box:

    1. Help - Find Action - Registry...
    2. Find git.use.builtin.ssh and enable it
    0 讨论(0)
  • 2021-01-31 08:00

    I had a similar problem in Android Studio 3.1

    I changed Preferences > Version Control > Git > SSH executable from Built-in to Native as suggested here but it didn't help.

    Then I upgraded Android Studio to 3.2 and switched back to Built-in. It fixed the issue in my case.

    0 讨论(0)
  • 2021-01-31 08:02

    Despite my SSH-executable was set to Native I was getting that error because I have set password for SSH key file.

    I haven't found the way how to specify password in Android studio but there is another solution, you can remove password which can be done with $ ssh-keygen -p. Then just confirm file location, enter your old password and leave new password blank.

    Taken from How do I remove the passphrase for the SSH key without having to create a new key?

    0 讨论(0)
  • 2021-01-31 08:05

    I ran across this myself, and found the existing answers were a bit incomplete.

    tl;dr: Switching Android Studio/IntelliJ's SSH client from built-in to native may resolve the issue for you (it did for me).

    Android Studio (effectively a specialized IntelliJ IDEA) comes with its own built-in SSH client, but allows you to switch to native (platform / OS dependent) if you prefer. You can change this by opening your Android Studio options, search for 'git', and choose 'native' in the SSH executable dropdown.

    In my case, I was unable to push to BitBucket through Android Studio, but git push worked just fine. Switching to native (OSX SSH, in my case) resolved the issue - now I can push to BitBucket from Android Studio.

    Other answers touched on the subject, but there appears to have been some mixup between SSH executables and the keys that they use.

    Per Android Studio help under SSH Executable:

    • Built-in: select this option to use the implementation provided by IntelliJ IDEA.
    • Native: select this option to use native implementation.
    0 讨论(0)
  • 2021-01-31 08:05

    If changing Preferences > Version Control > Git > SSH executable from Built-in to Native is not working then pls try with unchecking the Preferences > Version Control > GitHub>clone git repositories using ssh CHECK IT

    0 讨论(0)
  • 2021-01-31 08:06

    Go to github.com and open your repository and copy USE HTTPS url Go to your Android project directory. In the .git folder search for config file.

    IN the config file change url which you copied from github.com (use https) with the previous url. save config file and push again. This worked for me.

    0 讨论(0)
提交回复
热议问题