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 theheroku run bashcommand and see what’s there. Here’s what’s there for one of my apps:No
.gitdirectory, sogitcommands 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 thegitversion into your application code so you can display it as part of your app.