fatal: Not a git repository (or any of the parent directories): .git on every rails command but git commands works fine
I’ve got a problem with git and my rails project.
I have set up a github repository and successfully pushed four commits. Every git command i’m trying is working as expected (
git status, git add, git commit, git push etc.). But each time I try to execute a rails command (e.g.
bundle show, bundle install, rails s, rails generate, rake test etc.) I get following message in my console:
fatal: Not a git repository (or any of the parent directories): .git fatal: Not a git repository (or any of the parent directories): .git fatal: Not a git repository (or any of the parent directories): .git
Every time the message appears on three lines. Sometimes on six lines. The
.git folder is in my project and I’m in the correct folder. all rails commands are working as expected. But this annoying message comes with each rails command. I cloned the repository into another folder and created another repository and pushed the code to that new repositiory. The error is in my new folder, too.
I reinitialized my existing Git repository with
git init but that changed nothing.
When I set up a fresh rails project and push it into a new repository etc. there are no errors. What could be wrong with my project? Any idea, why this is happening and how to fix this?
I’m working with
rails 3.2.1 and
thx to @manojlds I could isolate the problem a little bit more. It’s the therubyracer gem. I don’t know what exactly is the problem but because I’m on windows I use this special therubyracer gem: https://github.com/hiranpeiris/therubyracer_for_windows. So I will ask the developer of this special gem and will show him the bundler bug. Maybe he will know if it’s a problem with his gem or with the bundler. The bundler has an updated pre release. But I can’t install the prerelease on windows. So I have to wait and therefore I must live for now with this annoying messages. Or is there a way to disable these messages?
Here is my github issue: https://github.com/hiranpeiris/therubyracer_for_windows/issues/1
4 Solutions collect form web for “fatal: Not a git repository (or any of the parent directories): .git on every rails command but git commands works fine”
There is a bug for Bundler, which could be related: https://github.com/carlhuda/bundler/issues/2039
Definitely not a problem with git or your git repo. Try updating bundler. ( not sure if the fix is in stable version yet )
git init in
It will initialize a new empty git repo there.
Make sure you are in the right directory when you run that command:
I had the same problem while installing node.js from git and found that I had to be in a subdirectory after downloading it for the tag versions to display.
For example, I ran this command to get node.js:
git clone https://github.com/joyent/node.git
… but then had to
cd node to be in the node subdirectory before the
git tag command worked.
The rubytheracer gem has lots of issues.
Switch to node or execjs to avoid them.