Intro
Remember, you cannot upload big files to the repo. In general > 3 ~4 MB is a big file.
For files >500KB and <3~4 MB you should use a GIT extension named Git Large File Storage (LFS) for more efficiency. Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server also in Gitlab. **Anyhow, do not upload files bigger than 3~4 MB to the LFS.
How to use
-
Download and install git-lfs:
-
Integrate Git-LFS in git
git lfs install
You do not need to repeat the previous steps anymore.
Once you want to add git-lfs support to any of the projects:
-
Go to the root of your repo. In order to be sure that everything is in order repeat the previous command
git lfs install
Check that it has created a file named .gitattributes
in your repo.
-
Next you need to tell which are the files that you want to track with the lfs, that is, which are the files formats that you do not want to include directly in the Git repo. For instance,
.stl
files and.mp4
files (videos) are examples of files that you should track.git lfs track '*.stl' git lfs track '*.mp4'
There are other ways of tracking files. For instance, you may want to track just the files in one folder. The patterns supported by Git LFS are the same as those supported by .gitignore
. You can find more info of the format at https://www.atlassian.com/git/tutorials/git-lfs#tracking-files
-
Add the
.gitattributes
to your repogit add .gitattributes git commit -m "Added git-lfs support" git push origin master
-
You can now progress as usual. You need to add and commit all the files (including the files that you do not want git to track directly) as you would do with any other file in your Git repo.