views:

172

answers:

1

I am a beginner in using Rails and Git I have InstantRails installed and created an app by:

$ rails myapp

It created all the necessary files. I went to the directory,

$ cd myapp

then I tried initializing git

$ git init

but it said : 'git' is not recognized as an internal or external command, operable program or batch file.

So I figured I might not have git installed. (Although I do have the Git Bash installed already.)

So I tried installing the gem

$ gem install git

Then it successfully installed, or so it seems.

But the same thing still happens.

I really need help. I'm getting confused. This is all new to me. :)

+1  A: 

First, git (ruby gem) and git (vcs) are different things - the former is a ruby interface for the latter. You have a problem with git (vcs). You may have installed git incorrectly - shell cannot find the main git executable in $PATH. How did you install it, by the way?

Edit: oh wait, from the error message I deduce that you are under Windows? I think, you must add the folder where you installed git to %PATH% manually in such case.

Manti
I installed Git msys from Google Code and InstantRails from Rubyforge.
KT
So, as I said, check that the folder where git is located is added to %PATH% (and that you opened new console after doing so - environment data won't be updated dynamically).
Manti
Yes, I am under Windows. So I should put the path where I installed it in the Environment Variables? Is that what you mean by %PATH%?
KT
I put the path already in the environment variables and restarted the computer afterwards. I still get the same error.
KT
Do you have git.exe at this path?. And just to make sure, when you execute 'echo %PATH%' in console, is there a proper path to git.exe among other values? Sorry for stupid questions, but I cannot think of another possible variants.
Manti
It's okay. I understand. I am really a beginner at this. But anyway, you solved the problem. The first time I put the variables in %PATH%, I only put the directory path to the Git folder. Until you said it must be directed to where the git.exe is, and so i entered the path again. And it worked! Thank you so much!
KT