Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket Server: how to determine what repo a physical LFS file belongs to

Deleted user May 15, 2018

Scanning our LFS files on our Bitbucket Server's host, I find some files that have issues (example: too big). I want to determine what Bitbucket project/repo an LFS file came from, but I have no idea how to do that, as the filenames are just hashes.

Does anyone know how to do this reverse lookup?

1 answer

1 vote
Andrei Khudavets
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 17, 2018

Hi Bill,

Probably the easiest (not necessarily the best) way to find the owner of the file is by repository hierarchy. In this example of path to LFS file:

... git-lfs/storage/569b0deeee77e67b5d4d/64/<file_name>

 

569b0deeee77e67b5d4d is a hierarchy ID

Once you know it, you can find repositories by hierarchy_id in the database: 

SELECT * FROM repository WHERE hierarchy_id LIKE '569b0deeee77e67b5d4d'

 

Note 1: if repository has forks, then all forks will have the same hierarchy_id

Note 2: if you manually delete the file from the disk, the repository will be corrupted 

 

I hope it helps.

Deleted user May 18, 2018

Thanks, I'll try this.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events