st2rseeker st2rseeker - 3 months ago 30
Git Question

Cannot clone git repository in WebStorm

While setting up a dev environment on a new Windows 10 machine, I have run into the following issue - I cannot clone a remote git repository via WebStorm (both version 11.0.4 and 2016.2 - both evaluations).

The curious thing is that I can successfully clone using Windows command line on same machine and other people successfully clone the same repo with a similar setup using WebStorm on different machines.

Git is installed to default location (

C:\Program Files\Git
) using the default Windows presets, the cmd directory is on PATH, username and email are configured (I've even tried to generate SSH keys) - and, again, clone works as expected in command line.

The URL of repo is
[username]@[ip]:/var/www/git/[repo.git]
(the repo lives on a local server). This URL is successfully used in command line clone and from other machine's WebStorms.

WebStorm git settings are default, with correct path to git.exe (the one in cmd directory), and Test works. Attempts were made both using the Built-in and Native variants.

When trying to checkout in WebStorm, Test fails with
Test repository failed
.

When opening the repo that was cloned via command line and trying to update in WebStorm, these are the results:

Built-in mode:


16:26:06.446: cd [redacted]
16:26:06.446: git -c core.quotepath=false fetch origin --progress --prune
error: cannot spawn C:\Users\User\AppData\Local\Temp\git-ssh-0.bat: No such file or directory
fatal: unable to fork


Native mode:


16:26:24.404: cd [redacted]
16:26:24.404: git -c core.quotepath=false fetch origin --progress --prune
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.


I have tried every voodoo magic I could think about (uninstalls, versions, UAC, processes, directories, PATH magic, etc.) and nothing managed to help.

Any help would be greatly appreciated - the next step on the list is Windows reinstall... :)

Answer

In my case this was the deal:

Webstorm was shooting an error about the file: intellij-git-ssh.bat. When I tried to double click it - I got an error that the file was not found.

Digging a bit further, I saw that this was the case for all bat file throughout the system. I had to verify that the system environment variable COMSPEC was set to: %SystemRoot%\system32\cmd.exe - it had some additional NodeJS suffxes that had no place to be there.

Re-opened the Webstorm - and voila!