Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm keypair setup to use gitlab

I just got a License for PhpStorm and I try to setup keypairs to can pull codes to Gitlab but I do not find where and how to make this? Where do I do this? The problem seems to be related that PhpStorm is not using root privileges.

like image 704
fefe Avatar asked Oct 21 '25 05:10

fefe


2 Answers

While I'm not entirely sure this is the most appropriate place to put this answer, I believe it is the most likely place others will end up at when facing issues trying to connect to GitLab via VCS for PHPStorm (or, really, any JetBrains IDE).

That being said, the issue I faced is very similar to the OP-- when running Git Bash, I had no issues at all connecting to Git Lab via SSH. However, when attempting a connection with PHPStorm's VCS via Git it would perpetually hang.

To precursor, my own findings are secluded to those of you running JetBrain IDEs on Windows.


The solution is:

  1. First you must (obviously) have an SSH key created and registered for your GitLab user account.
  2. As @Spero.ShiroPetto has mentioned, PHPStorm does indeed utilize the standard $HOME/.ssh directory for SSH Keys. So:
    • Ensure your newly generated Key files are available from your home directory, inside the .ssh folder.
    • PHPStorm also uses the standard naming convention for these files, so for the sake of simplicity, keep these named as "id_rsa" and "id_rsa.pub".
  3. (OPTIONAL) It would be good practice to also create a config file for your SSH keys. This will help in the event you need to have multiple key's down the line. If you're using a non standard SSH port, or if there are other non standard parameters associated with the connection to the server, this really is a must.
  4. Now, you're ready to open up PHPStorm but, before doing so, ensure you are running it as Administrator. This is necessary because when using VCS for Git, PHPStorm creates a batch file in your temp directory. This file must be writable for PHPStorm, and this is accomplished most simply by running the application as an Administrator.
  5. Finally, before attempting to test/clone the repo from your GitLab server, you'll need to set Git to use it's built-in SSH executable when accessing Git. So:
    • open up the settings for PHPStorm (File->Settings or Ctrl+Alt+S)
    • Expand the Version Control section in the Project Settings and select Git
    • Ensure that the SSH-Executable is set to "Built-in". (While you're here, you might as well ensure that the Git executable is also set correctly. You can hit the Test button to verify this)

If like the OP and myself, you've been able to connect via Git Bash before, then at this point you should be able to connect and use VCS for your Git needs.

like image 73
cbrendanprice Avatar answered Oct 23 '25 19:10

cbrendanprice


You have o create a pair of keys on the shell. Therefore follow these instructions. Then copy the content of the public key to your GitLab user account.

like image 33
Razer Avatar answered Oct 23 '25 21:10

Razer