onok onok - 2 months ago 20x
Git Question

Cannot push to git from windows/phpstorm

My repository is on Bitbucket. I have a Ubuntu machine that I use as a development server (which hosts a local copy of all my code, apache, php, git etc). The actual development is done on a Windows machine in the same LAN. I use a Samba share to access the files on the server directly.
I use PHPStorm as my IDE. I installed git on the Windows machine as well, in order to use git integration in PHPStorm. And it works: I can read the repository history and commit new changes withouth problem.

But now I want to push (to bitbucket) from PHPStorm as well. And that is what fails.

Right now, I need to login to my Ubuntu server to push code from there. But I'd like to be able to psuh from PHPStorm. It has probably to do with ssh-keys I need to integrate, but I don't know how. PHPStorm tells me the following:

19:22:10.873: git push --progress origin master:master
java.io.IOException: Authentication failed:
at org.jetbrains.git4idea.ssh.SSHMain.authenticate(SSHMain.java:283)
at org.jetbrains.git4idea.ssh.SSHMain.start(SSHMain.java:157)
at org.jetbrains.git4idea.ssh.SSHMain.main(SSHMain.java:137)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

I already created a SSH key pair and put the public key on Bitbucket. I just don't know where to go from here.


The PhpStorm git Integration man page does mention:

  • ssh keys are generated outside PhpStorm. You can follow the instructions from http://inchoo.net/tools/how-to-generate-ssh-keys-for-git-authorization/ or look for other guidelines.
  • Store the ssh keys in the home_directory \.ssh\ folder. The location of the home directory is defined through environmental variables:
    • $HOME for Unix-like operating systems.
    • %userprofile% for the Microsoft Windows operating system.
  • Make sure, the keys are stored in files with correct names:
    • id_rsa for the private key.
    • id_rsa.pub for the public key.