Git LFS (Large File Storage)



Getting Started

Download and install the Git command line extension. Once downloaded and installed, set up Git LFS for your user account by running:
git lfs install
You only need to run this once per user account.


In each Git repository where you want to use Git LFS, select the file types you'd like Git LFS to manage (or directly edit your .gitattributes). You can configure additional file extensions at anytime.
git lfs track "*.psd"
For more than one extention tracking, just type:
git lfs track "*.apk" "*.app" "*.bin" "*.bundle" "*.cmproj" "*.csv" "*.deb" "*.dmg" "*.exe" "*.gz" "*.jpeg" "*.jpg" "*.img" "*.ipa" "*.iso" "*.mkv" "*.mov" "*.mp3" "*.mp4" "*.msi" "*.psd" "*.pdf" "*.pkg" "*.png" "*.rar" "*.raw" "*.sql" "*.tar" "*.tar.gz" "*.trec" "*.txt" "*.xip" "*.zip" "*.7z"
Now make sure .gitattributes is tracked:
git add .gitattributes
Note that defining the file types Git LFS should track will not, by itself, convert any pre-existing files to Git LFS, such as files on other branches or in your prior commit history. To do that, use the git lfs migrate[1] command, which has a range of options designed to suit various potential use cases.


There is no step three. Just commit and push to GitHub as you normally would; for instance, if your current branch is named master:
git add file.psd
git commit -m "Add design file"
git push origin master


To unlock LFS, follow these steps on this url.
https://github.com/git-lfs/git-lfs/wiki/File-Locking

Managing Locked Files

When you are ready to edit files, run the lock command:

$ git lfs lock images/foo.jpg
Locked images/foo.jpg
This registers the file as locked in your name on the server. You can view this with the locks command.
$ git lfs locks
images/bar.jpg  jane   ID:123
images/foo.jpg  alice  ID:456
The file will also be ready for you to edit and push locally. If at any time you decide you don't need the lock, you can remove it by passing the path or ID to the unlock command.
$ git lfs unlock images/foo.jpg
$ git lfs unlock --id=456

You can also unlock someone else's file with the --force flag:

$ git lfs unlock images/foo.jpg --force
Note: Different LFS server implementations may have different permissions. Some may require admin privileges to unlock someone else's lock, for example.



Git LFS is an open source project
To file an issue or contribute to the project, head over to the repository or read our guide to contributing.

If you're interested in integrating Git LFS into another tool or product, you might want to read the API specification or check out our reference server implementation.


LFS Files corrupted on clone (Un-completed files download)

Try this command. It will re-download LFS files.

$ git lfs pull (enter)


Source :

https://git-lfs.github.com

https://stackoverflow.com/questions/46334725/git-lfs-how-to-track-multiple-file-types-with-one-command

https://github.com/git-lfs/git-lfs/wiki/File-Locking

https://github.com/git-lfs/git-lfs/issues/678

Comments