How to imitate Git LFS file locking behaviour in Artifactory?

Nimer Bsoul
2019-06-06 13:27


Currently when a user attempts to lock a git LFS repository, they get a 404 Not Found response, since the command is currently not supported by Artifactory, and this error could lead to users believing that there is a configuration problem.

Affected Versions

All versions


Artifactory has the ability to handle user management and permissions that can be used to imitate the file lock behaviour.
The permissions feature in Artifactory provides the ability to quickly change permissions on artifacts or paths, you can specify an exclude pattern to any permission that grant the “Delete / Overwrite” permission on your Git LFS repositories.

This would involve first getting the current permissions JSON using the Artifactory REST API:

curl -u <ADMIN>:<PASSWORD> -XGET http://<ART_UR>:<ART_PORT>/artifactory/api/security/permissions/<GIT_LFS_PERMISSION>
This will return a .json file containing the current permission configuration. You could then add on a new line to the JSON:
  "excludesPattern": "<ARTIFACT_PATH>"
And then re-upload the JSON to Artifactory as the same permission:
curl -u <ADMIN>:<PASSWORD> -X PUT -H “Content-type: Application/json” --data @upload.json http://<ART_UR>:<ART_PORT>/artifactory/api/security/permissions/<GIT_LFS_PERMISSION>
The above steps can be accomplished via a script.