致命:不是 git 存储库...错误消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14269058/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:00:33  来源:igfitidea点击:

fatal: Not a git repository ... error message

ruby-on-railsgitherokupush

提问by stefkas

When I git push on heroku, I receive this fatal: Not a git repository (or any of the parent directories): .giterror many times. Everything works fine in my application and the push completes normally. I just wonder why this happens. I also see the same message 4-5 times in my logs in heroku, when a scheduler task runs. Any idea? Thanks!

当我在 heroku 上 git push 时,我fatal: Not a git repository (or any of the parent directories): .git多次收到此 错误。在我的应用程序中一切正常,推送正常完成。我只是想知道为什么会发生这种情况。当调度程序任务运行时,我还在 heroku 的日志中看到 4-5 次相同的消息。任何的想法?谢谢!

git push staging master

Counting objects: 41, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 1.74 KiB, done.
Total 21 (delta 20), reused 0 (delta 0)
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.3.0.pre.5
      Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
      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
      Fetching gem metadata from https://rubygems.org/..........
      Fetching gem metadata from https://rubygems.org/..
      Using rake (10.0.3)
      Using i18n (0.6.1)
      Using multi_json (1.5.0)
      Using builder (3.0.4)
      Using erubis (2.7.0)
      Using journey (1.0.4)
      Using rack-cache (1.2)
      Using rack-test (0.6.2)
      Using jquery-rails (2.0.2)
      Using backbone-on-rails (0.9.2.1)
      Using bcrypt-ruby (3.0.1)
      Using sass (3.2.1)
      Using cancan (1.6.7)
      Using carrierwave (0.6.2) from git://github.com/jnicklas/carrierwave.git (at master)
      Using chosen-rails (0.9.8)
      Using coffee-rails (3.2.2)
      Using commonjs (0.2.6)
      Using orm_adapter (0.3.0)
          .......

      Using warden (1.2.1)
      Using devise (2.1.2)
      Using nokogiri (1.5.4)
      Using ruby-hmac (0.4.0)
      Using fog (1.3.1)
      Using gmaps4rails (1.5.5)
      Using jquery-datatables-rails (1.10.0)
      Using jquery-fileupload-rails (0.3.4)
      Using jquery-ui-rails (2.0.2)
      Using less (2.2.2)
      Using less-rails (2.2.6)
      Using bundler (1.3.0.pre.5)
      Using rails (3.2.11)
      Using newrelic_rpm (3.5.3.25)
      Using paper_trail (2.6.3)
      Using pg (0.13.2)
      Using sass-rails (3.2.5)
      Using simple_form (2.0.2)
      Using squeel (1.0.11)
      Using strong_parameters (0.1.5)
      Using therubyracer (0.10.2)
      Using twitter-bootstrap-rails (2.1.9)
      Using uglifier (1.2.5)
      Using validate_email (0.1.5)
      Using validate_url (0.2.0)
      Your bundle is complete! It was installed into ./vendor/bundle
      Cleaning up the bundler cache.
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
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
      Running: rake assets:precompile
      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
      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
      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
      Asset precompilation completed (274.30s)
-----> Rails plugin injection
      Injecting rails_log_stdout
      Injecting rails3_serve_static_assets
-----> Discovering process types
      Procfile declares types      -> (none)
      Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 31.8MB
-----> Launching... done, v22
      http://***************-staging.herokuapp.com deployed to Heroku

回答by William Seiti Mizuta

You need to do a git initin your project to initialize a git repository. You can see heroku configuration in the following link git remote doesn't seem to be working at all.

你需要git init在你的项目中做一个来初始化一个 git 仓库。您可以在以下链接中看到 heroku 配置git remote 似乎根本不起作用

回答by drhenner

This is really really late but you should try this:

这真的很晚了,但你应该试试这个:

heroku labs:enable user-env-compile

run that in the console and then update your repo. Then push to github... Then push to heroku. Good luck

在控制台中运行它,然后更新你的仓库。然后推送到github...然后推送到heroku。祝你好运

回答by tamersalama

Compiling the assets locally then push to heroku worked for me.

在本地编译资产然后推送到 heroku 对我有用。

This: https://stackoverflow.com/a/22975650/7693

这个:https: //stackoverflow.com/a/22975650/7693