1

I'm using webpack-git-hash and on my machine it works as expected. As soon as I deploy the project on Heroku I get this error:

Error: Command failed: git rev-parse --short=7 HEAD
fatal: Not a git repository (or any parent up to mount point /app)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

What happens when I push a repo to Heroku? The .git folder is placed somewhere else?

1 Answers1

0

As part of the process of Heroku transforming your repository (or whatever it is you're pushing from a CI tool) to a runnable slug, they drop the git history contents. It can get quite big, and it's not worthwhile to have it in the slug/container.

You can see more in the slug compiler page of Heroku.

Horia Coman
  • 8,681
  • 2
  • 23
  • 25
  • So any build process attempting to append a git hash on Heroku won't work? –  Aug 15 '17 at 14:02
  • 1
    You have to put that hash from another source. For example, in your CI tool you'll have access to this information and if you've configured it to do the build and then push to Heroku you might be able to work something like that. Alternatively, [this](https://stackoverflow.com/questions/14583282/heroku-display-hash-of-current-commit) question seems to offer a lot of good info about dealing with exactly your problem. – Horia Coman Aug 15 '17 at 14:15