https://git-lfs.github.com/
Git Large File Storage | 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 like GitHub.com or GitHub Enterprise.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install git-lfs
git lfs install git lfs track "*.psd" git add .gitattributes git add file.psd git commit -m "Add design file" git push origin master
檔案鎖的用途是用戶可以對一個檔案進行加鎖,阻止其他用戶同一時間對該檔案進行修改操作。因為在GIT倉庫中同時編輯一個檔案,會發生衝突,然而解決二進制大檔案的衝突,合併操作極其困難。
neo@MacBook-Pro ~/workspace/java-project % git lfs lock test.psd Locked test.psd neo@MacBook-Pro ~/workspace/java-project % git lfs locks test.psd bg7nyt ID:55777
如果Push被鎖的檔案,提示 Remote "origin" does not support the LFS locking API
neo@MacBook-Pro /tmp/java % git commit -a -m 'aaa' [master b832eb3] aaa 1 file changed, 2 insertions(+), 2 deletions(-) neo@MacBook-Pro /tmp/java % git push Remote "origin" does not support the LFS locking API. Consider disabling it with: $ git config 'lfs.https://github.com/bg7nyt/java.git/info/lfs.locksverify' false Post https://github.com/bg7nyt/java.git/info/lfs/locks/verify: EOF error: failed to push some refs to 'https://github.com/bg7nyt/java.git'
解鎖後Push成功
neo@MacBook-Pro ~/workspace/java-project % git lfs unlock test.psd Unlocked test.psd neo@MacBook-Pro /tmp/java % git push Git LFS: (1 of 1 files) 9 B / 9 B Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 352 bytes | 352.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), completed with 1 local object. To https://github.com/bg7nyt/java.git b29f474..b832eb3 master -> master