GitLFS is a good option for storing blobs such as binaries or any large non-source code artifact. This blog post shows you how to use GitLFS.
If you haven’t installed GitLFS just yet, then you need to install it first by entering the line below: git lfs install . Also, if haven’t created a git repo then you need to run the command git init.
If you already have a remote git repo then you can simply clone it using the well known command git clone <git_server_url>.
You need to configure your GitLFS server. Edit the git config file by adding the following sections:
Also add the following gitlfs config file:
Then the most important part is tracking the files you wish to store in the GitLFS server. A GitLFS server can be the same git server or a separate / dedicated server. To achieve this you can enter git lfs track “*.<file_extension>”
The next steps are straight forward, you simply run the usual commands git add <file_or_directory_path>, git commit -m “<commit_description>” and git push -u origin all. This works behind the scenes during git pull / push, so if you check your GitLFS server afterwards you will notice that the git server will only store pointers to the actual file in GitLFS server.
If you’re using a self-signed certificate on your GitLFS server then you might need to run the following line too: git config –global –add http.sslVerify false .
I hope this saves you sometime in your next gitlfs related endeavor.
[ Update 10Oct2016: if you get the error “Your local changes to the following files would be overwritten by merge”, you will need to do the following -more info here-]
git checkout HEAD^<file_to_overwrite>
git pull -f
[ Update 10Oct2016: don’t forget to create a dev branch and merge it once your binaries have been pushed into the repo –more info here-]
git checkout -b dev_branch
git checkout master
git merge dev_branch
Javier Andrés Cáceres Alvis