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

前端 未结 12 1130
醉酒成梦
醉酒成梦 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:40

    I got the same issue. Turns out it matters how you run Android Studio. If you run it with normal privileges from terminal or sth, it cannot read local files that it has to in order to push repository.

    Solution might just be to restart Android Studio with more privileges than it currently has.

    0 讨论(0)
  • 2021-01-31 07:45

    There is two ways for Git SSH verification in Android Studio or IntelliJ, changing via: settings - Version Control - Git - SSH excuteable - "Built-in" or "Native"

    1. Built-in : means using ssh key pair built in Git for authentication. you can generate it via
      ssh-keygen -t rsa
      the default saved path is "~/.ssh/id_rsa" and "~/.ssh/id_rsa.pub". You should add the Public key in your BitBucket account. the path like : manage account - SSH keys - add keys
    2. Native : means using the ssh pair generated by the native repository hosting service, such as BitBucket or GitHub, which is often auto-add in the service account. For example in GitHub. It generated a pair of SSH key, "~/.ssh/github_rsa.pub" and "~/.ssh/github_rsa" and the Public key has been auto-added in my account via GitHub GUI maybe. So change the SSH executable to "Native" could be a simple way.

    Anyway, you can use the both way after you add the correct Public key in you acoount in repository hosting service.

    0 讨论(0)
  • 2021-01-31 07:47

    This is probably an Intellij problem. Your key are managed natively by ssh, and Intellij has it's own ssh program.

    Go to the settings, search git->ssh executable then choose native

    As seen here : git with IntelliJ IDEA: Could not read from remote repository

    0 讨论(0)
  • 2021-01-31 07:47

    I have met this problem, and finally I have solved it. And there are two important points for setting: In the android studio: File-Settings-GitHub: not to choose "Clone git repositories using ssh" In the android studio: File-Settings-Git: Choose "Built-in" for "SSH executable"

    and for the SSH that I already have in the account of GitHub, is the one that I have in the android studio, I forget how to find the SSH in the android studio, But you can find it by the other way

    0 讨论(0)
  • 2021-01-31 07:52

    Regenerate your public ssh key and add it to your git hub repository.

    ssh-keygen -t rsa
    

    It worked in my case.

    0 讨论(0)
  • 2021-01-31 07:53

    Go to Settings > Version Control > Git. Make sure SSH executable is set to “Native.”

    If it's already set, switch back to “Built-in,” apply it, and then again switch back to “Native".

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