Install Git LFS
Before getting started, make sure you have Git LFS installed in your computer. Open a terminal window and run:
If it doesn’t recognize this command, you must install it. There are several installation methods that you can choose according to your OS. To install it with Homebrew:
Once installed, open your local repository in a terminal window and install Git LFS in your repository. If you’re sure that LFS is already installed, you can skip this step. If you’re unsure, re-installing it does no harm:
For more information, see Git Large File Storage (LFS).
Lock files
By locking a file, you verify that no one else is editing it, and prevent anyone else from editing the file until you’re done. On the other hand, when you unlock a file, you communicate that you’ve finished editing and allow other people to edit it.To lock or unlock a file with Exclusive File Locking, open a terminal window in your repository directory and run the commands as described below.
To lock a file:
To unlock a file:
You can also unlock by file ID (given by LFS when you view locked files):
If for some reason you need to unlock a file that was not locked by yourself, you can use the --force flag as long as you have Maintainer permissions to the project:
You can push files to GitLab whether they’re locked or unlocked.