Skip to content

Instantly share code, notes, and snippets.

@Jaboo9
Last active July 4, 2020 17:47
Show Gist options
  • Save Jaboo9/cc9cd8bac225c12fe41966d4ac9106c0 to your computer and use it in GitHub Desktop.
Save Jaboo9/cc9cd8bac225c12fe41966d4ac9106c0 to your computer and use it in GitHub Desktop.
Learning about Git LFS

What is Git LFS

Git Large File Storage (LFS) is an open source Git extension for versioning large files.

It 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 like GitHub.com or GitHub Enterprise.

Click here to download.

Configuring Git Large File Storage

Once Git LFS is installed, you need to associate it with a large file in your repository.

If there are existing files in your repository that you'd like to use GitHub with, you need to first remove them from the repository and then add them to Git LFS locally. For more information, see "Moving a file in your repository to Git LFS."

If there are referenced Git LFS files that did not upload successfully, you will receive an error message. For more information, see "Resolving Git Large File Storage upload failures."

  1. Open Terminal.

  2. Change your current working directory to an existing repository you'd like to use with Git LFS.

  3. To associate a file type in your repository with Git LFS, enter git lfs track followed by the name of the file extension you want to automatically upload to Git LFS.

For example, to associate a .psd file, enter the following command:

$ git lfs track "*.psd"

Adding path *.psd

Every file type you want to associate with Git LFS will need to be added with git lfs track. This command amends your repository's .gitattributes file and associates large files with Git LFS.

Tip: We strongly suggest that you commit your local .gitattributes file into your repository. Relying on a global        .gitattributes file associated with Git LFS may cause conflicts when contributing to other Git projects.
  1. Add a file to the repository matching the extension you've associated:

    $ git add path/to/file.psd
    
  2. Commit the file and push it to GitHub:

    $ git commit -m "add file.psd"
    $ git push origin master`
    
  3. You should see some diagnostic information about your file upload:

    Sending file.psd

    44.74 MB / 81.04 MB  55.21 % 14s
    
    64.74 MB / 81.04 MB  79.21 % 3s
    

GitHub official documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment