I've got this chunk of code that pulls the git version of the current repo when the environment kicks on (environment.rb).
APP_VERSION = `git describe --always --long` unless defined? APP_VERSION
That let's me pull up the site, go to a certain page and see that the version that's on the site is the right one. This bit of code was working on EngineYard, but on Heroku I'm getting this when the app starts up:
fatal: Not a git repository (or any of the parent directories): .git
Is running git describe
possible on heroku?
I don't think you can; when you deploy your app to Heroku using git push
, it appears to put it into a repository, then do a clean checkout of your code without a git repository. You can poke around using the heroku run bash
command and see what's there. Here's what's there for one of my apps:
$ 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
No .git
directory, so git
commands won't work.
If you want to just see what version is currently deployed, you can see that from the Heroku Dashboard for your app, under the Activity tab. (https://dashboard.heroku.com/apps/[your app name]/activity
) But I'm not sure how to get the git
version into your application code so you can display it as part of your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With