6

I have completed a project on Node.js which has already pushed into GitHub, this project has a video which larger than 100MB which required Git LFS. Git LFS successfully pushed into the GitHub no issue at all.

The second phase of this project is to host in Heroku, this is where I got stuck. I tried both:

heroku buildpacks:add https://github.com/BureauxLocaux/heroku-buildpack-git-lfs.git

and

heroku buildpacks:add (name of the app given by heroku)/heroku-buildpack-git-lfs

When it's pushed using

git push heroku master --no-verify

I get the following error:

remote: -----> Git LFS app detected
remote: Env var BL_BUILDPACK_GIT_LFS_REPO is not set
remote:  !     Push rejected, failed to compile Git LFS app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to intense-journey-80070.
remote: 
To https://git.heroku.com/intense-journey-89070.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/intense-journey-89070.git'

How can I make this work?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Ranga
  • 141
  • 2
  • 6

4 Answers4

1

You say

heroku buildpacks:add (name of the app given by heroku)/heroku-buildpack-git-lfs

but you shouldn't use your app name here. I guess you want to use this buildpack? In that case, you should literally do

heroku buildpacks:add https://github.com/BureauxLocaux/heroku-buildpack-git-lfs.git

You also have an error message saying

Env var BL_BUILDPACK_GIT_LFS_REPO is not set

There is some additional configuration required for the buildpack, as outlined in its buildpack page on Heroku, which you appear not to have done:

Set the following environment variable for your app:

  • BL_BUILDPACK_GIT_LFS_REPO to the clone URL of the repository from which to download Git LFS assets. This should include any username, password, or personal access token which is necessary to clone noninteractively. See here for details on the syntax. It must be something like git@github.com:BureauxLocaux/my-repo
  • BL_BUILDPACK_GIT_LFS_SSH_PRIVATE_KEY: your private key encoded in base64 with base64 -w 0. You can use heroku config:set --app preprod-bureauxlocaux "BL_BUILDPACK_GIT_LFS_SSH_PRIVATE_KEY=$(cat ~/.ssh/heroku_deploy_lfs | base64 -w 0)" to set it.

Private SSH keys should be protected bordering on paranoia, so make sure to use a dedicated SSH key that is only used for deployment of this repository. Give that deploy key the lowest level of permission that you can.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Hi Chris Thanks for the reply I tried it but still get the same error. also followed what was on heroku site. still no luck. Also, edited the question to make it more clear. Please bear with me I'm new to this. – Ranga Jun 24 '20 at 10:23
  • @Ran, there should be more to that message than "pre-recieve hook declined". Please edit your question and add what comes before that. Also, how big a payload are you trying to inject via LFS? – ChrisGPT was on strike Jun 24 '20 at 12:28
  • I have updated the error message in my question, the payload is 287MB images and one 187MB large video especially the video. – Ranga Jun 25 '20 at 09:39
  • @Ran, you haven't configured the buildpack. I updated my answer, but please remember to read the documentation of the tools you are using. This was right there in the README. (And the first part of my answer is still relevant. Adding a buildpack whose URL points to the application you're modifying doesn't make sense.) – ChrisGPT was on strike Jun 25 '20 at 20:10
  • The only issue here is that even this repo does not help beyond the size of 500 MB. – Inaam Ilahi Aug 30 '22 at 08:23
1

The files that are linked to Large File System (LFS) are not supported in Heroku.

So you need to move to settings on heroku to add configs vars as key “HEROKU_BUILDPACK_GIT_LFS_REPO” to value “https://@github.com//repository.git” token is a unique personal Access token. You need to register for that in your GitHub > settings> Developer Settings for Heroku to access your LFS files and also link in buildpacks to install LFS “https://github.com/raxod502/heroku-buildpack-git-lfs.git”.

Lastly, hit the deploy button in the deploy section and you are done with your project and available for people accessing over the internet.

0

Unfortunately Heroku doesn’t support git LFS at the moment.

Heroku doesn’t support git lfs. Using this method can cause pushes to fail.

https://devcenter.heroku.com/articles/git#deploy-from-a-branch-besides-main

crg
  • 4,284
  • 2
  • 29
  • 57
-2

Basically you can simply follow the instruction in this post. What I need to say is that when you register GitHub app, the URL you need to fill in "Webhook URL" and "Homepage URL" is both the URL you created using heroku (Example format: https://<app-name>.herokuapp.com).

Memphis Meng
  • 1,267
  • 2
  • 13
  • 34