Enable and Use Git LFS to Version Large Files

If your projects contain large files, especially ones that are modified often, an initial clone can take a long time because your Git client needs to download every version of every file. Git LFS (Large File Storage) minimizes the time needed for downloading large files in your repository by downloading the relevant versions during the checkout process instead of during clone or fetch operations. Git LFS does this by replacing large files in your repository with small pointer files that you'll probably never even see. Git LFS automatically handles the replacements and stores the large file contents on a local file system or a remote server.

In VB Studio, by default, Git LFS is enabled in all Git repositories for the entire organization.

If you need to store large or binary files in your project, this is how you enable and use Git LFS for a repository in the project:

  1. Clone the project's Git repository.

    You can find the URL for the remote repository from the Project Home page's Repositories tab. From the Clone drop-down list, click Copy to clipboard the Copy icon to copy the URL, then paste it to the command line:

    git clone <SSH/HTTPS repository URL>

    You must be connected to the Internet and to the remote repository to check out a branch locally. This is required.

  2. Enable LFS for the local Git repository:

    git lfs install

    This is required because the + File button on the Git page can't be used to upload or add a binary file directly in a remote Git repository. The only way to add a binary file is through a cloned repository.

  3. Specify the file(s) to track:

    git lfs track *.bin

  4. Stage the files to be committed:

    git add .

    git add .gitattributes

  5. Commit the files to the local repository:

    git commit -A -M "Initial commit using LFS"

  6. Push the commits to the remote repository:

    git push origin main

    When a binary file is pushed to a remote Git repository, it's stored on the VB Studio-connected OCI Object Storage bucket. A reference is added to the Git repository, not to the file.

    If a connection to the OCI Object Storage bucket can't be made, you'll see an error message that indicates storage hasn't been enabled.

    When a Git repository that uses Git LFS is deleted, its binary files on OCI Object Storage will also be deleted.