Gitblit provides a filestore that supports the Git Large File Storage (LFS) API.
Gitblit is configured to work straight away. However you may want to update the following in gitblit.properties
:
parameter | value | description |
---|---|---|
filestore.storageFolder | ${baseFolder}/lfs | The path on the server where filestore objects are to be saved. |
filestore.maxUploadSize | -1 | The maximum allowable size that can be uploaded to the filestore. Once a file is uploaded it will be unaffected by later changes in this property. The default of -1 indicates no limits. |
Gitblit currently provides a server-only implementation of the opensource Git LFS API.
Items 2 & 3 are pending JGit Git LFS client capabilities.
.gitattributes
file.git lfs install
.For further details check out the Git LFS specification.
It is possible to migrate an existing repository containing large files to one that leverages the filestore. However, commit hash history will be altered.
The following command may be run on a local repository:
git filter-branch --prune-empty --tree-filter '
git lfs track "*.docx" "*.pdf" > /dev/null
git add .gitattributes
git ls-files | xargs -d "\n" git check-attr filter | grep "filter: lfs" | sed -r "s/(.*): filter: lfs/\1/" | xargs -d "\n" -r bash -c "git rm -f --cached \"\$@\"; git add \"\$@\"" bash \
' --tag-name-filter cat -- --all
While other Git LFS implementations are available as there is no current JGit LFS client capability, Gitblit will be unable to access them.