Git-LFS

SmartGit provides support for common Git Large File Storage (Git-LFS) operations, allowing you to use LFS functionality such as LFS file tracking and locking, from the comfort of the SmartGit GUI. Please refer to Git LFS concepts for background, and benefits of using Git-LFS on selected files in your repository.

Tip

The Git LFS extension needs to be installed on your local computer, and LFS filters need to be enabled for a repository where LFS file storage will be used. It is recommended that you use the version of the Git executable that comes bundled with SmartGit, and use SmartGit to enable and configure LFS with your repositories for best compatability.

Enabling Git-LFS on a Git Repository with SmartGit

After selecting the required repository from the Repository View, use Local | LFS | Install to enable LFS support for your repository. SmartGit will prompt for confirmation. Select OK to confirm LFS support for the repository.

This runs the equivalent git lfs install command in the repository

Tracking a new file in LFS

After adding a new file under the Working Tree of your local repository, select the untracked file in the Files View and use the LFS | Track command to track this file in LFS.

SmartGit will show a LFS Track dialog, prompting you to provide a tracking pattern:

  • The default pattern will track just the selected file
  • You can expand the pattern to include all files matching a pattern - use * as a wildcard, e.g. *.png will track all new files with a .png extension in LFS.

Note

If you are encountering unexpected errors when invoking Lock or Unlock on Window, this may be caused by a strange behavior of current Git-LFS versions (2.5) which will fail when invoked with a working directory with wrong case. To workaround the problem, make sure that the path in repositories.xml has correct case, especially the drive letter must be uppercase, for example:

<obj type="@Repository" id="...">
    <prop key="name" type="String" value="smartgit"/>
    <prop key="favorite" type="boolean" value="true"/>
    <prop key="git" type="boolean" value="true"/>
    <prop key="path" type="String" value="D:\\smartgit"/>
    <prop key="expanded" type="boolean" value="false"/>
</obj>

Displaying locks

To see Git-LFS lock states in the Files views (both Log and Working tree window), Git-LFS locks verification must be enabled for your repositories. A corresponding .git/config might look like:

[lfs "https://server/repo.git/info/lfs"]
    ...
    locksVerify = true

Furthermore, you have to enable property status.lfs.locks in the Preferences, section Low-level Properties. This will make SmartGit invoke additional commands:

  • git lfs locks --local
  • git lfs locks --remote

after every Pull, Fetch and after every background Fetch (if enabled in the Preferences, section Background Commands).

The output of these git lfs locks commands will be written to:

  • ./git/smartgit/lfs-locks-local
  • ./git/smartgit/lfs-locks-remote

Once these files are present, the Name column icon will start denoting the locking state for LFS files.

Example

The following screenshot shows how this display will look like:

  • file is normal file to which no LFS lock information applies
  • huge is locked by someone else
  • huge2 is locked by yourself
  • huge3 is lockable (configured in .gitattributes)

Note

In the Log window, lock states will only be displayed for the Working Tree node.

Fix possible problems

If your git-lfs executable is not found by SmartGit, try to use absolute paths for the git-lfs executable configuration in the gitconfig file containing the Git-LFS filter definition.