Tips For Pushing Large Files To Github

Tips For Pushing Large Files To Github

Article Overview

Reading Time: 19 minutes

Posted on: Sunday June 21, 2020

Have you tried pushing big sizes file like ExpressPlay.framework but GitHub not allows uploading such large files? If yes then follow this post to save some valuable time.

In some instances writing a descriptive README files for GitHub repos is a good practice. We tried this in one for our apps that’s dedicated for food lovers by giving it ratings; add information, and images using camera and third party APIs. When our developers tried to upload a big video file to our GitHub repo, the push commit was rejected, because the file was larger than 50 MB.

Image 01

The most frustrating part here was: 1) large file size and 2) incomplete knowledge made every push took so long.

So how to push big size files like audios, videos, datasets, and graphics to GitHub?

We are one of the leading web development company in Dubai and our team of expert developers resolved this problem tactically (We hope that it will be helpful for others who bump into the same issue).

1. Follow instructions in the push commit error and visit git-lfs.github.com. Now download Git extensions for adapting large files (Git LFS) or get it installed through Homebrew. **Please Note: Remove every large file from local repo directory before initiating to set tracking for Git LFS.

2. Here’s something tricky: One might have already added and removed a large file numerous times and also tried to push to GitHub but commits still have large file data that can be tracked locally and hasn’t been pushed.

3. It’s required to remove the commits or checkout changes, but this problem might arise: whenever a large file is removed from local repository, get it reset to a commit present before the file got added.

4. The git log and git reset commands are helpful to reset that commit.
Example:

Image 02

5. Set up Git LFS tracking for file types you require to add for repository.  For example:

git lfs track “*.psd” // for photoshop files
git lfs track “*.gif” // for gif video files

6. Now add these file to your repository where LFS will track it towards push commit. Then add, commit, and push as usual.

Example:

git add AppDemo.gif
git commit -m “Add video demo”
git push origin master

7. Remember that while data uploading gets finished, you might see the same error (i.e. file is too large) in terminal. Analyze repository on GitHub’s website and refresh the browser. The file will get uploaded, despite the error message.

8. So, once again:

Start by adding git lfs track and then add a large file (like audio, etc.) to your repo. You can also refer Atlassian tutorial on Git workflows referred by expert web development company in UAE. Also there are numerous workflows which can be followed while project working is in groups of two or more people: one can utilize the same master branch, or work off different branches of the same repo, or work on different forks. Those getting confused about which pattern to follow can look at above recommend tutorial. It will help you to become better developer and a good team contributor. But it’s majorly dependent on practice!!

We are including the search keywords like: github pre-receive hook declined, github squash commits, git push large files, git outside repository, used for doing research on this problem.