Artifactory support for Git LFS provides you with a fully functional LFS server that works with the Git LFS client.
In addition, from version 4.4, Artifactory supports authenticating your Git LFS client via SSH.
'git' is properly installed (run
$ git --versionto verify).
- Git LFS local repository in your Artifactory.
Download the Git LFS client from: https://git-lfs.github.com/.
At the time of writing this article, the current version of Artifactory (v5.2) does not support SSH authentication for Git LFS client versions 2.x. To check if your version of Artifactory supports SSH authentication for Git LFS v2.x, please refer to this JIRA issue.
If you are unsure, we recommend using Git LFS version <= 1.5.6.
Verify that Git LFS is properly installed by running
$ git lfs version.
Git LFS must be initialized by running
$ git lfs install(see step 5 below), similarly to
$ git init.
Start a new project or clone a git project, that is already connected to a git host and is up-to-date with your host. For example, you may clone any of your projects on github.
To make sure your branch is up-to-date run
$ git status. If everything is configured correctly, you should get the following messages:
$ On branch master$ Nothing to commit, working tree clean$ Your branch is up-to-date with 'origin/master'.
- In your git directory, run
$ git lfs
installto initialize Git LFS in your project.
In Git LFS you have to track the files you wish to push using the Git LFS client. You can either track specific files, or select patterns using wildcards. In this example we will track all '*.zip' files.
Therefore either copy a zip file into your git directory, or create a new file. (Note: Make sure your file isn't empty, as the client is checksum based and doesn't support working with empty files).
$ git lfs track "*.zip"
This creates a '.gitattributes' file.
Add the zip and
$ git add .gitattributes
$ git add test.zip
- Commit the files added:
$ git commit -m "test gitlfs"
Tip: If you want the Git LFS client to automatically fetch artifacts from a configured LFS server, you should also modify the .lfsconfig file (explained below) which will be added and committed along with the other files. This will prevent other users from configuring their own .lfsconfig file as it will be cloned along with the Git repository.
- Before "pushing", you need to configure a Git LFS host to obtain the LFS files.
In your Git directory, open your
.lfsconfigfile or create a new one.
Enter the "Set Me Up" popup for your Git LFS repository in Artifactory and copy the
[lfs]clause into the
(NOTE: The Artifactory URL specified in your
.lfsconfigfile must NOT be localhost or 127.0.0.1.)
$ git push origin master
Your tracked file should be in your Git LFS repository.
You will be prompted to enter your credentials when pushing. Alternatively, you can provide basic authentication credentials in your
url = "http://<user>:<password>@<artiServer>/artifactory/api/lfs/<GitLFSrepoKey>"
It is also possible to use Git LFS with Gerrit.
Here is a blog that elaborates on this and how to set it up together with Artifactory:
You can migrate from using GitLFS on GitHub to a local GitLFS repository on Artifactory.
$ git statusto show your current status.
Adding GIT_TRACE=1 to a push command will enable verbose output. For example,
$ GIT_TRACE=1 git push origin master
After the first push, the
[lfs]clause from the
.lfsconfigfile should be added to the
.git/configfile (in the git directory). For example,
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true[remote "origin"] url = https://github.com/MYGITHUB/PROJECT.git fetch = +refs/heads/*:refs/remotes/origin/*[branch "master"] remote = origin merge = refs/heads/master[lfs "http://my.artifactory:8081/artifactory/api/lfs/lfs-local"] access = basic
Configuring Git LFS Authentication with SSH
Make sure you have your SSH authentication configured properly, and that Artifactory has been added as a known host on your system.
To authenticate with SSH, change the lfs URL in both the
.git/config files as follows: