Git LFS: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 29: Line 29:


==Install LFS Support==
==Install LFS Support==
If LFS support is not installed on a machine,
git lfs
will fail with:
git: 'lfs' is not a git command. ...
===Mac Installation===


  brew install git-lfs
  brew install git-lfs


{{Warn|If LFS support is not installed on a machine and a repository that contains LFS files is cloned, the "large files" will be represented as pointers, and not binaries locally.}}
{{Warn|If LFS support is not installed on a machine and a repository that contains LFS files is cloned, the "large files" will be represented as pointers, and not binaries locally.}}
===Linux Installation===
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
sudo yum install git-lfs


==Check if LFS is Enabled for a Repository==
==Check if LFS is Enabled for a Repository==

Latest revision as of 17:57, 26 November 2019

External

Internal

Overview

Git LFS is a system for managing and versioning large files in association with a Git repository. Instead of storing the large files within the Git repository as blobs, Git LFS stores special "pointer files" in the repository, while storing the actual file contents on a Git LFS server. The contents of the large file are downloaded automatically when needed, for example when a Git branch containing the large file is checked out. Git LFS works by using a "smudge" filter to look up the large file contents based on the pointer file, and a "clean" filter to create a new version of the pointer file when the large file's contents change. It also uses a pre-push hook to upload the large file contents to the Git LFS server whenever a commit containing a new large file version is about to be pushed to the corresponding Git server.

LFS support must be explicitly enabled per-repository with:

git lfs install

If another collaborator on your repository does not have Git LFS installed, they won't have access to the original large file. If they attempt to clone the repository, they will only fetch the pointer files, and won't have access to any of the actual data.

.gitattributes

Files managed by LFS are declared in the repository's .gitattributes.

...
something/somethinglse.jar filter=lfs diff=lfs merge=lfs -text
...

Operations

Install LFS Support

If LFS support is not installed on a machine,

git lfs 

will fail with:

git: 'lfs' is not a git command. ...

Mac Installation

brew install git-lfs

If LFS support is not installed on a machine and a repository that contains LFS files is cloned, the "large files" will be represented as pointers, and not binaries locally.

Linux Installation

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash
sudo yum install git-lfs

Check if LFS is Enabled for a Repository

Verify if .git/hooks/pre-push and .git/hooks/post-checkout hooks exists and mention LFS.

Enable LFS for a Repository

In the repository:

git lfs install

Sets up git LFS per repository by installing the LFS configuration..

Information about LFS Files

git lfs ls-files
git lfs status