How to Upload Files Greater Than 100MB on Github

Git-LFS

Git LFS (Large File Storage) is a Git extension that replaces large files with text pointers within the Git repository while storing the actual file contents in a separate storage. This helps to manage efficiently and version control large files such as audio, video, and other binary files within a Git repository. The "git lfs" command is used to interact with Git LFS, allowing users to track, manage, and version large files while optimizing the performance of the Git repository. Commands such as "git lfs track" are used to specify which file types should be managed by Git LFS, and "git lfs push" and "git lfs pull" are used to push and pull the actual large files to and from the LFS storage.

Git LHS

Installing Git LFS


Windows

  1. Download the Git LFS installer for Windows from the official Git website (https://git-lfs.com/).
  2. Run the installer and follow the on-screen instructions to complete the installation.

Linux

  1. You can install Git LFS on Linux using package managers like apt, yum, or dnf, depending on your distribution.
  2. For example, on Debian/Ubuntu, you can install Git LFS by running the following commands in the terminal.
    sudo apt-get install git-lfs

macOS

  1. On macOS, you can install Git LFS using Homebrew, a popular package manager for macOS.
  2. Open a terminal and run the following command to install Git LFS using Homebrew.
    brew install git-lfs

Always ensure you have the necessary permissions and administrator rights to install software on your system, and refer to the specific documentation for your operating system or package manager if needed.

Setting Up Git LFS

Once installed, configure Git LFS by running.

git lfs install

To use Git LFS, we must first configure our GitHub repository as a Git LFS repository. So, we must ensure that we have the.gitattribute file inserted with git lfs defined for certain file types, in my instance, the.bin file.

git lfs track "*.bin"

The above command will do the job for you. All the large files that will be added now will automatically be uploaded using git lfs.

However, because I already have a.bin file in my current repo. As a result, I must execute the following.

git lfs migrate import --include="*.bin" --everything

Note: you can also play and experiment with the git lfs command at git-lfs-migrate(1).

To view which files are tracked by git lfs, use the following

git lfs ls-files

Pushing code to GitHub

Since I am done setting up the Git LFS repo, I will make a commit, to make sure my change is tracked.

git add .
git commit -m "Git LFS feature added"
git push -u origin main //change the remote and main according to your branch

Conclusion

Finally, Git LFS is a beneficial Git plugin that provides an excellent solution for handling huge files within repositories. While it offers various advantages, such as improved binary file version control and increased repository speed, it is crucial to evaluate possible downsides and restrictions. Understanding the trade-offs of utilizing Git LFS is critical for making educated judgments about its use in version control processes.


Similar Articles