1

I have working code on my personal machine that executes git describe via clojure.java.shell and shows that version info on the settings page. But when this runs on Heroku, even adjusting the path to the same one I get from which git on a heroku run bash prompt, I get this error:

{:exit 128, :out , :err fatal: Not a git repository (or any parent up to mount point /app)}

And checking from the heroku bash prompt again, I see no .git directory.

How could I access the current git tag and SHA from inside my Clojure app?

jmckitrick
  • 171
  • 6

1 Answers1

1

Heroku doesn't give you access to this directory, the slug compiler strips it before build time.

Step 2: Remove unused files, including .git directories, .gitmodules files, anything in log and tmp, and anything specified in a top-level .slugignore file.

https://devcenter.heroku.com/articles/slug-compiler

There are some circuitous workarounds suggested in Heroku - Display hash of current commit.

See also https://github.com/heroku/heroku-cli/issues/14 for discussion about why providing the .gif folder could be a bad idea. Short answer: size, and that the .git directory is not always provided by the user in different deploy modes.

Community
  • 1
  • 1
Daniel Compton
  • 13,878
  • 4
  • 40
  • 60