简体   繁体   English

致命:不是git存储库(或任何父目录):.git on every rails命令但是git命令工作正常

[英]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. 我遇到了git和我的rails项目的问题。

I have set up a github repository and successfully pushed four commits. 我已经建立了一个github存储库并成功推送了四个提交。 Every git command i'm trying is working as expected ( git status, git add, git commit, git push etc.). 我正在尝试的每个git命令都按预期工作( git status, git add, git commit, git push等)。 But each time I try to execute a rails command (eg bundle show, bundle install, rails s, rails generate, rake test etc.) I get following message in my console: 但每次我尝试执行rails命令(例如bundle show, bundle install, rails s, rails generate, rake test等)时,我在控制台中收到以下消息:

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. .git文件夹在我的项目中,我在正确的文件夹中。 all rails commands are working as expected. 所有rails命令都按预期工作。 But this annoying message comes with each rails command. 但是这个烦人的消息随每个rails命令一起提供。 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. 我用git init重新初始化了我现有的Git存储库,但没有改变。

When I set up a fresh rails project and push it into a new repository etc. there are no errors. 当我设置一个新的rails项目并将其推入新的存储库等时,没有错误。 What could be wrong with my project? 我的项目有什么问题? Any idea, why this is happening and how to fix this? 任何想法,为什么会发生这种情况以及如何解决这个问题?

I'm working with ruby 1.9.3 , rails 3.2.1 and git 1.7.9 . 我正在使用ruby 1.9.3rails 3.2.1git 1.7.9

thx to @manojlds I could isolate the problem a little bit more. thx到@manojlds我可以更多地隔离问题。 It's the therubyracer gem. 这是therubyracer的宝石。 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 . 我不知道究竟是什么问题,但因为我在Windows上我使用这个特殊的therubyracer宝石: https//github.com/hiranpeiris/therubyracer_for_windows So I will ask the developer of this special gem and will show him the bundler bug. 所以我会向开发人员询问这个特殊的gem并向他展示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. 但我无法在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 这是我的github问题: https//github.com/hiranpeiris/therubyracer_for_windows/issues/1

Try running git init in 尝试运行git init

RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0beta1-x86-mingw32 . RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/therubyracer-0.11.0beta1-x86-mingw32

It will initialize a new empty git repo there. 它会在那里初始化一个新的空git repo。

There is a bug for Bundler, which could be related: https://github.com/carlhuda/bundler/issues/2039 Bundler有一个错误,可能是相关的: https//github.com/carlhuda/bundler/issues/2039

Definitely not a problem with git or your git repo. 绝对不是git或你的git repo的问题。 Try updating bundler. 尝试更新bundler。 ( not sure if the fix is in stable version yet ) (不确定修复程序是否处于稳定版本)

Make sure you are in the right directory when you run that command: 运行该命令时,请确保您位于正确的目录中:

git tag

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. 我从git安装node.js时遇到了同样的问题,发现在下载后我必须在子目录中才能显示标签版本。

For example, I ran this command to get node.js: 例如,我运行此命令来获取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. ...但是在git tag命令工作之前,必须将cd node放在node子目录中。

The rubytheracer gem has lots of issues. rubytheracer宝石有很多问题。

Switch to node or execjs to avoid them. 切换到节点或execjs以避免它们。

More at: Rails - Could not find a JavaScript runtime? 更多内容: Rails - 找不到JavaScript运行时?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Capistrano DigitalOcean Ubuntu 14.04致命:不是git存储库(或任何父目录).git - Capistrano DigitalOcean Ubuntu 14.04 fatal: Not a git repository (or any of the parent directories) .git 致命:不是git存储库...错误消息 - fatal: Not a git repository … error message openshift部署输出有很多:'远程:致命的:不是git存储库(或任何挂载点/ var / lib / openshift的父目录)' - openshift deploy output has many: 'remote: fatal: Not a git repository (or any parent up to mount point /var/lib/openshift) ' 当我在git命令提示符下键入“ git add”时,收到致命消息,即不是git存储库。 - I am getting fatal message i.e not a git repository, when I am typing “git add .” in git command prompt. Rails控制器中的git命令 - git command in rails controller 然后分支“重置” Rails Git存储库 - Branch Then 'Reset' Rails Git Repository 致命的:'git_url'似乎不是git存储库 - fatal: 'git_url' does not appear to be a git repository git - 无法推送到远程,错误'致命:不是git存储库' - git - can't push to remote, error 'fatal: Not a git repository' 安装Git-'$ man git'有效,但是'$ git'返回'找不到命令' - Installing Git - '$ man git' works, but '$ git' returns 'command not found' Rails 3 / Git / Bundler致命无法解析对象 - Rails 3/ Git/ Bundler Fatal could not parse object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM