8
votes

I am having trouble adding a plugin to Cordova 3.3.0 on Windows. I have node.js installed. I have been able to create a project. I have git installed and the git bin directory is on my PATH. I am able to run git on the windows command line. But when I try to install a plugin I get this error:

Error: Fetching plugin failed: Error: "git" command line tool is not installed: make sure it is accessible on your PATH.

This sequence of commands works up until I try and add the plugin:

  • cordova create myProject
  • cd myProject
  • cordova platform add android
  • cordova plugin ls

Then I try to add the plugin with the following and it fails:

I have spent a whole day trying to figure this out. Any ideas?

5
open cmd and type git does it work ?user2377528

5 Answers

20
votes

Download and install git from http://git-scm.com/downloads . Set path in System Environment variable pointing to the installation path, in my case C:\Program Files (x86)\Git\bin.

So go to control panel-> system ->Advance System Settings -> Environment Variable -> System Variable

Select Path and Edit it. Append C:\Program Files (x86)\Git\bin to it.

That's it. If it still doesn't work run git once from programs. It will work for sure.

3
votes

Yes, the below solution worked for me download and install git from http://git-scm.com/downloads . Set path in System Environment variable pointing to the installation path, in my case C:\Program Files (x86)\Git\bin.

So go to control panel-> system ->Advance System Settings -> Environment Variable -> System Variable

Select Path and Edit it. Append C:\Program Files (x86)\Git\bin to it.

That's it. If it still doesn't work run git once from programs. It will work for sure.

2
votes

1.) Search for the 'Git Shell' application on Windows Search. If you find it, skip to step 3.

2.) So, you did not find Git Shell.Download and install Github for Windows from http://windows.github.com/,

3.) Open Git Shell, which is a Git-enabled version of Windows CMD. Run your plugin install command from the Git Shell, and it should run.

The only difference of this method from DChamp's solution is that you won't need to bother with modifying path yourself, if you use Git Shell.

2
votes

Here is the exact solution.

Hi "git" is also a node module.

npm install -g git

This will install git in you node source location as a module. Restart the machine.

Install phonegap plugin: C:\Users\user1\yourprojectname>cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git

You will get response as: Fetching plugin from "https://git-wip-us.apache.org/repos/asf/cordova-plugin-cam era.git"... Starting installation of "org.apache.cordova.camera" for android Preparing android project org.apache.cordova.camera installed on android.

Hope this will be very helpful. If any issue reply.

2
votes

I had this problem on Windows Vista - I spent many hours trying to debug it!

Turns out Environment Variable's were indeed the culprit. I can never put a finger on whether a program wants a quoted variable to get around spaces or not!

My system variable %GIT_HOME% was using quotes likes so:

  • "C:\Program Files (x86)\Git";"C:\Program Files (x86)\Git\bin"

This was in the %Path% system variable like so..

  • %GIT_HOME%;%ANDROID_HOME%;%ANT_HOME%;%JAVA_HOME%;%PHP_HOME%;... etc.

Now I've changed %GIT_HOME% to:

  • C:\Program Files (x86)\Git;C:\Program Files (x86)\Git\bin

It works perfectly. In fact - now NetBeans will create Cordova projects (which had also been failing)

Hope this fixes it for you.