PHPStorm is set up to use Git. The path to git executable is set and tested. I have set up user id and password for Github and tested (but I don't really want to use this, I want to use SSH keys.) SSH is using built-in. BitBucket plugin is downloaded and installed from that chaps fork, not from Atlassian (sorry, I forget his name.). SSH agent forwarding allows you to use your private, local SSH key remotely without worrying about leaving confidential data on the server you’re working with. It’s built into ssh, and is easy to set up and use. What Is an SSH Agent? Your public SSH key is like your username or identity, and you can share it with everybody.
Using the PhpStorm built-in SSH terminal and remote SSH external tools Maarten Balliauw August 7, 2013 We can already do a lot from within our IDE: develop our application, connect to database systems, work with source control, debug HTTP traffic and much, much more. With the PhpStorm 7 EAP, we are introducing even more integrations. Essentially, you want to set the Xdebug IDE port to 9000 and the IDE key to PHPSTORM. Triggering Xdebug. On a development box it’s sufficient for the server to connect back to port 9000 on the IDE over HTTP. To connect over an SSH tunnel, here is a guide from the makers of PhpStorm: Remote debugging in PhpStorm via SSH.
In PhpStorm, you can save the remote server SSH connection parameters as a dedicated SSH configuration. The created configuration can be then used for configuring remote interpreters, connecting to SFTP deployment servers, and launching SSH sessions.
In the Settings/Preferences dialog Ctrl+Alt+S, go to Tools | SSH Configurations.
In the left-hand pane that lists all the existing SSH configurations, click .
Use the Visible only for this project checkbox to configure the visibility of the server access configuration.
Select the checkbox to restrict the use of the SSH configuration to the current project. Such SSH configuration cannot be reused outside the current project. It does not appear in the list of available configurations in other projects.
The SSH configurations are stored in the .idea directory together with the project, which allows sharing them between team members through a VCS.
When the checkbox is cleared, the SSH configuration is visible in all PhpStorm projects. Its settings can be reused across several projects.
In the Host, User name, and Port fields, specify the connection parameters. If necessary, you can provide the outgoing port in the Local port field. Otherwise, the port is selected automatically.
Choose the way to authenticate to the server. Do one of the following:
Password: to access the host with a password. To save the password in PhpStorm, select the Save password checkbox.
Key pair (OpenSSH or PuTTY): to use SSH authentication with a key pair. To apply this authentication method, you must have a private key on the client machine and a public key on the remote server. PhpStorm supports private keys that are generated with the OpenSSH utility.
Specify the path to the file where your private key is stored and type the passphrase (if any) in the corresponding fields. To have PhpStorm remember the passphrase, select the Save passphrase checkbox.
OpenSSH config and authentication agent: to use SSH keys that are managed by a credentials helper application (for example, Pageant on Windows or ssh-agent on macOS and Linux).
See the Generating a new SSH key and adding it to the ssh-agent tutorial for details on working with SSH keys.
If you select the OpenSSH config options, PhpStorm parsers OpenSSH directives recorded in SSH config file: /etc/ssh/ssh_config > and ~/.ssh/config on Linux and macOS, or C:Users<username>.sshconfig on Windows. PhpStorm supports a limited set of OpenSSH directives.
Click the Test connection button to make sure that the settings are correct and PhpStorm can connect to the target server.
Supported OpenSSH directives
I’m one of the rare Windows users at Automattic but thanks to the introduction of Windows Subsystem for Linux, my life is way easier. I can now run pretty much any Bash script without having to spin up a virtual machine like I used to have to. While it’s possible to build Node.js-powered projects natively under Windows thanks to the Windows-Build-Tools package, it’s a lot easier to just do everything within Linux. This is largely because building in one environment means that you can’t run the tools in the other environment.
Phpstorm Sshfs
The main time that this bites you is when the project you’re working on has a pre-commit hook in Git. If you build your project in Linux but attempt to commit from Windows, it won’t work. IDEs such as PhpStorm do all of their Git operations from Windows. This blog post will explain how to get it to use the copy of Git within Linux.
- Install Pageant from PuTTY or if you’re signing your commits, then Gpg4win (its gpg-connect-agent can be set to be PuTTY compatible). Have it start with Windows in order to load your SSH keys.
- Verify that the agent is working by using PuTTY to connect to
github.com
with the usernamegit
. GitHub won’t let you open a shell but it’ll let you know that you have successfully authenticated. Note that command linessh
won’t work because it’s not Pageant-compatible. - Install weasel-pageant to allow you to use SSH keys from within Linux.
- Verify that the agent is working by running
ssh-add -l
in Linux. Your key(s) should be listed. - Verify SSH is working by running
ssh git@github.com
. If it doesn’t work, append-vvv
to the end of the command to enable debug output to see what’s wrong.
Now that you have Git authentication working within Linux, it’s time to get PhpStorm (or whatever IDE you use) to use Linux’s Git.
The trick here is instead of having PhpStorm use git.exe, you need to point it at a batch script. This Stack Overflow question helped me a ton, but I needed to modify it a little bit.
For whatever reason, my .bashrc
file wasn’t being loaded when calling bash.exe -c
which meant that agent wasn’t being loaded. So as a part of my batch script, I’m manually loading my personal file that contains my shell customizations. Here’s my full batch file:
In PhpStorm, go to File → Settings (or Default Settings) → Version Control → Git and set the “Path to Git executable” to point at the batch file. Verify that it works by clicking the Test button.
With that, everything should work now!
Phpstorm Ssh
Questions? Problems? Leave a comment below.