Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot push to git from windows/phpstorm

Tags:

git

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.

like image 852
onok Avatar asked Jul 15 '14 17:07

onok


People also ask

How does PhpStorm integrate with Git?

Open the project that you want to put under Git. Press Alt+` to open the VCS Operations Popup and select Enable Version Control Integration. Alternatively, from the main menu, select VCS | Enable Version Control Integration. Choose Git as the version control system and click OK.

How do I commit in PhpStorm?

Starting from PhpStorm version 2020.1, you can switch to a non-modal commit interface: select the Use non-modal commit interface option (enabled by default for new installations) on the Version Control | Commit page of the IDE settings Ctrl+Alt+S .


2 Answers

If your git commands work from the commandline, but not from inside WebStorm, you could try switching your WebStorm configuration to use "Native" instead of the "Built-in" SSH executable.

To do this, navigate the menus for Files -> Settings -> Version Control -> Git and then change the SSH executable dropdown setting to "Native."

like image 136
Dean Cirielli Avatar answered Oct 08 '22 14:10

Dean Cirielli


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.
like image 24
VonC Avatar answered Oct 08 '22 12:10

VonC