Ruby on rails 我可以在heroku应用程序中运行'git descripe'';s environment.rb?
我有一段代码,当环境启动时(environment.rb),它会提取当前回购的git版本 让我打开网站,转到某个页面,看看网站上的版本是否正确。这段代码在EngineYard上运行,但在Heroku上,当应用程序启动时,我得到了以下信息:Ruby on rails 我可以在heroku应用程序中运行'git descripe'';s environment.rb?,ruby-on-rails,git,heroku,Ruby On Rails,Git,Heroku,我有一段代码,当环境启动时(environment.rb),它会提取当前回购的git版本 让我打开网站,转到某个页面,看看网站上的版本是否正确。这段代码在EngineYard上运行,但在Heroku上,当应用程序启动时,我得到了以下信息: 致命:不是git存储库(或任何父目录):.git 在heroku上运行git descripe是否可行 我认为你做不到;当您使用git push将应用程序部署到Heroku时,它似乎将其放入存储库中,然后在没有git存储库的情况下对代码进行干净的签出。您可以使
致命:不是git存储库(或任何父目录):.git
在heroku上运行
git descripe
是否可行 我认为你做不到;当您使用git push将应用程序部署到Heroku时,它似乎将其放入存储库中,然后在没有git存储库的情况下对代码进行干净的签出。您可以使用heroku run bash
命令查看其中的内容。下面是我的一个应用程序的内容:
$ heroku run bash
Running `bash` attached to terminal... up, run.1
~ $ ls -a
. bin config.ru Gemfile lib public .rspec TODO.txt
.. .bundle db Gemfile.lock Procfile Rakefile script vendor
app config doc .gitignore .profile.d README spec
没有.git
目录,因此git
命令不起作用
如果您只想查看当前部署的版本,可以从应用程序的Heroku仪表板的“活动”选项卡下查看。(
https://dashboard.heroku.com/apps/[您的应用程序名称]/activity
),但我不确定如何将git
版本放入您的应用程序代码中,以便您可以将其显示为应用程序的一部分。很酷,这似乎不会发生。我尝试使用ENV['COMMIT_HASH'],但它似乎也不起作用。是的,它也不是环境变量。这似乎是一件合理的事情,但事实并非如此。相关:
$ heroku run bash
Running `bash` attached to terminal... up, run.1
~ $ ls -a
. bin config.ru Gemfile lib public .rspec TODO.txt
.. .bundle db Gemfile.lock Procfile Rakefile script vendor
app config doc .gitignore .profile.d README spec