How do I get more info on files in Git LFS shared storage

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Purpose

When files are tracked with Git LFS, they are stored in an embedded LFS object store on the Bitbucket Server host machine.

Since all repositories share this object store, it can be useful to know how to trace the hash that represents the stored object back to:

  • the repository it is associated with

  • the commit hash associated with the object

  • the information about the file being tracked by Git LFS

This guide will outline steps to gather these items.

Solution

  1. On the Bitbucket Server host machine, go to the $BITBUCKET_HOME/shared/data/git-lfs/storage location. This directory should contain a number of subdirectories with character strings for names, eg. d9a89a25acb91c5e3289.

  2. In the subdirectory, there will be another subdirectory with a 2 character string name, eg. ec and in that directory there should be a file with a long string for the name, eg e19c6a918a8a8079d1957c89622784908732c2e86696d6fc98bfc31c71f6c5.

  3. When you combine the 2nd subdir name (ec) with the file name (e19c6a918a8a8079d1957c89622784908732c2e86696d6fc98bfc31c71f6c5) you have the oid that the pointer in the repository uses to retrieve the git lfs tracked file when the repository is cloned, eg. ece19c6a918a8a8079d1957c89622784908732c2e86696d6fc98bfc31c71f6c5.

  4. From the repository's location on disk you can run the following git log to get information regarding the file being tracked by git lfs:

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 root@stash0:/var/atlassian/application-data/bitbucket/shared/data/repositories/13# git log --all -p -S ece19c6a918a8a8079d1957c89622784908732c2e86696d6fc98bfc31c71f6c5 commit 9e237c1f25499e4f7a4c31774aa81e99da742a99 Author: Nathaniel Hansberry <nhansberry@atlassian.com> Date: Tue Apr 11 09:54:18 2017 -0500 Added an image diff --git a/bf.jpg b/bf.jpg new file mode 100644 index 0000000..e21a255 --- /dev/null +++ b/bf.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ece19c6a918a8a8079d1957c89622784908732c2e86696d6fc98bfc31c71f6c5 +size 57364

    If the repository ID is unknown we can move to the $BITBUCKET_HOME/shared/data/repositories directory and use the command above in a for loop to find the associated repository:

    1 for i in `ls`;do echo $i; cd $i; git log --all -p -S ece19c6a918a8a8079d1957c89622784908732c2e86696d6fc98bfc31c71f6c5; cd -;done

    The number preceding the git log info is the repository ID.

  5. From the $BITBUCKET_HOME/shared/data/repositories we can use the find command and the commit hash (minus the first 2 characters) to get the path to the pointer that is actually located in the repository:

    1 2 root@stash0:/var/atlassian/application-data/bitbucket/shared/data/repositories# find . -name 237c1f25499e4f7a4c31774aa81e99da742a99 ./13/objects/9e/237c1f25499e4f7a4c31774aa81e99da742a99

Updated on April 14, 2025

Still need help?

The Atlassian Community is here for you.