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

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 Android Studio every time I try to push the project it says

Push failed: fatal: Could not read from remote repository.

Does anyone have a clue about what could be happening?


Solution 1:

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

Solution 2:

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".

enter image description here