Using Git-LFS to upload big files to Github

I had a side project to help update a department’s website. The design agency they contracted with delivered the site in PHP and the method of updating the site was uploading new content via FTP.

The first thing I did was fetch the content off the server and commit to a local git repo to preserve its current state. But I couldn’t push the content up to Github because of large PDF files over 50 MB and up to 250 MB in size. Although the 90s and Web 1.5 are back, there are 21st century tools to help: Git LFS.

About Git LFS

Git LFS is a supplemental Git utility that breaks up large files behind the scenes so that they can be uploaded to Github within file size limits (50 MB). It needs to be installed separately, after git.

Following the instructions at https://packagecloud.io/github/git-lfs/install (Linux version shown here)

  1. curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
  2. sudo apt-get install git-lfs
  3. Head over to the repo with large files and declare the large files pattern from the instructions here: https://github.com/git-lfs/git-lfs#example-usage
  4. I ran into a problem at the step where I push the repo back up to Github after marking large files and setting up git-lfs: “x509 signed by unknown authority
      1. To resolve this, disable ssl verification for the specific site (awful workaround):
        $ git config http.https://git.sample.com.sslVerify false
  5. Push the code to the repository, it should work now.

Leave a Reply

Your email address will not be published. Required fields are marked *