Using large file system (LFS)

Prev Next

Available in Classic and VPC

You can upload files to the Git repository with a limit of up to 500 MB. If you use Git Large File System (Git LFS), you can perform the version management of large files (maximum of 5 GB per file) in the Git repository. Git LFS performs by committing only metadata of large files into the repository and storing the actual content in the extra remote storage.

Requirements for using Git LFS

To use Git LFS, install Git client and Git LFS on a local PC.

  • Access GIT official website to download and install Git client files. Check the detailed user guides.
  • Access GIT LFS official website to download and install Git LFS files. Check the detailed user guides.
  • Git LFS only supports HTTPS connection, not SSH connection.
Note
  • When you share the Git LFS-applied repository for common projects, ensure all members install Git LFS on their local PC and understand how Git LFS works and is used.
  • Unless you install Git LFS on a local PC, you cannot perform large file management and file lock tasks using LFS feature.
  • After you download and install Git LFS, initialize Git LFS in the repository you are working on as follows:
    $ git lfs install
    
    Git LFS initialized.
    

Large file system

To upload large files using Git LFS, follow these steps:

The user guides describe how to initialize Git LFS in the local repository, set the tracking on specific files, and push files to the remote repository with a simple example. For more information on how to use Git LFS, see GIT LFS official website.

  1. Perform Git Client on a local PC. Move to the repository route.

  2. Initialize Git LFS.

    $ git lfs install
    
    Git LFS initialized.
    
  3. Set tracking on large files to be uploaded. Add .gitattributes files to the commit list.

    • You can specify several files using wildcard (*).
    • The .gitattributes files record tracking history.
    $ git lfs track "*.psd"
    Tracking "*.psd"
    
    $ git add .gitattributes
    
  4. Commit large files to be uploaded. Push the files to the remote repository.

    $ git add sample.psd
    
    $ git commit -m "Added design file"
    
    $ git push origin master
    
Note
  • If errors such as timeout (i/o timeout) happen during the upload, you can extend the waiting time as follows:
    $ git config lfs.activitytimeout 300
    
  • After you complete the file upload, you can check that tracking-set large files are stored in LFS type in [Code] tab of the SourceCommit repository.

File lock

You can set the environment where only certain accounts can edit or upload the locked files using Git LFS file lock feature.

Note
  • You can use the file lock feature only in versions later than Git LFS 2.0.
  • If you want the Git client to correctly identify the file lock status, set the file lock feature in your local PC repository.

To set the file lock feature, follow these steps:

$ git config lfs.{Git URL}/info/lfs.locksverify true
Note
  • Only the account that sets the file lock feature can unlock the feature.

  • Unless you set the lock feature, the feature may not correctly work. If you upload the file locked by other accounts, you can see a warning message as follows:

    $ git push origin master
    
    Locking support detected on remote "origin". Consider enabling it with:
    $ git config lfs.{Git URL}/info/lfs.locksverify true
    Unable to push locked files:
    
    test.txt - psr (refs: master)
    WARNING: The above files would have halted this push.
    

Example of file lock

After you enable the file lock, you can upload or unlock files only by the sub account that set the feature.

  • Set file lock by "sub account 1"

    $ git lfs lock "test.txt"
    Locked test.txt
    
    $git lfs locks
    test.txt {sub_account_name} ID:15
    
  • Upload files by "sub account 2" (error occurred)

    $ git add test.txt
    
    $ git commit -m "Modify file"
    
    $ git push origin master
    Unable to push locked files:
    * test.txt - {sub_account_name} (refs: master)
    ERROR: Cannot update locked files.
    

Example of file unlock

  • Unlock by "sub account 1" (unlock succeeded)

    $ git lfs unlock test.txt
    Unlocked test.txt
    
  • Unlock by "sub account 2" (error occurred)

    $ git lfs unlock test.txt
    test.txt is locked {Sub Account1}
    

Git LFS Object Storage integrations

You can upload the LFS files to your Object Storage bucket by integrating the Object Storage bucket with SourceCommit.

Note
  • Uploaded or downloaded data not using Git LFS is not stored in the Object Storage bucket.

Object Storage integrations settings

To set SourceCommit's Object Storage integrations, follow these steps:

  1. From the NAVER Cloud Platform console, navigate to i_menu > Services > Developer Tools > SourceCommit.
  2. Click the [Object Storage integrations settings] button on SourceCommit page.
  3. Select the bucket you want to integrate with in the Object Storage integrations settings popup window.
  4. Click the [Settings] button in the Object Storage integrations settings popup window.
Caution
  • When the bucket set to be integrated is deleted, the integrations are automatically disabled.
  • The direct data edit through Object Storage console is not limited. When you edit, some features may not work properly.
Note
  • If the repository is enabling integrations with the bucket, you cannot change the bucket.
  • The locked bucket doesn't support bucket integrations.

Enable repository Object Storage bucket

To integrate an Object Storage bucket with a repository, you must enable bucket usage in the repository settings. To enable the bucket, follow these steps:

Note
  • To enable the repository's Object Storage bucket, you must integrate SourceCommit with Object Storage bucket.
  • Even if the repository's Object Storage bucket becomes disabled, the data already stored in the bucket remains.

How to upload in bucket for existing LFS users

To shift the storage by enabling the Object Storage bucket for existing LFS users, follow these steps:

Caution

To ensure a safe migration, it is recommended to back up your data locally in advance.

  1. Download all LFS binary data stored in the existing repository to your local system.
    $ GIT_LFS_SKIP_SMUDGE=0 git clone <repository-url>
    or
    $ git lfs pull (if repository already exist)
    
  2. Enable Object Storage bucket integration for the repository.
  3. Re-upload all LFS track binary data to Object Storage.
    $ git lfs push origin --all
    
  4. Check the uploaded data through Object Storage bucket console.