Home > database >  Cannot access GIT remote with PhpStorm and WSL and Private Key
Cannot access GIT remote with PhpStorm and WSL and Private Key

Time:07-28

When trying to clone a remote repository in PhpStorm on Windows into WSL2 subsystem (\\\$wsl\somedir\) over SSH ([email protected]/user/repo.git) I get an error „Permission denied (public key)“. Private key is correctly located within /home/user/.ssh/id_rsa.

But when trying the same from a shell within WSL directly (after a eval ssh-agent and ssh-add) that works. But it is not possible using the PhpStorm GUI (New Project -> Get from VCS).

CodePudding user response:

Private key is correctly located within /home/user/id_rsa.

The default localtion should be /home/user/.ssh/id_rsa, not /home/user/id_rsa.

If that was a typo, and the key is actually in .ssh, open PhpStorm from a shell where you type first: export GIT_SSH_COMMAND='ssh -Tv'.

Check the terminal (or try and clone from the terminal) to see what Git is trying to access as private key.

CodePudding user response:

Solution simply seems to be changing access rights for the private key stored in WSL with „chmod 0600 id_rsa“.

  • Related