How to check the status of Large File Storage (LFS) setting across all Bitbucket Data Center repositories

Still need help?

The Atlassian Community is here for you.

Ask the community

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

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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

Summary:

To find out if LFS is permitted in a repository, a user can navigate to Repository settings > Repository details and look for the Allow LFS checkbox. However, administrators may occasionally need to check the LFS status of all repositories.

Environment:

Bitbucket Data Center 7.21.0 and above.

Solution:

  • For LFS to be enabled at the repository level, the Git LFS enabled checkbox in Server settings must be selected. The following query will only produce output if the LFS is enabled in server settings.
  • The LFS-enabled repository does not imply that the repository has the LFS files. Even if LFS is enabled in the repository, a developer can choose not to track LFS files.

A repository's LFS Enable or Disable status is stored in the AO_811463_GIT_LFS_REPO_CONFIG table. You can use the below query to find the LFS status of all repositories using a single query, this query is for PostgreSQL and may need to be modified for alternate database engines.

select r.id         as repo_id,
       r.slug       as repo_slug,
       r.name       as repo_name,
       r.project_id as project_id,
       p.name       as project_name,
       CASE
           WHEN a."IS_ENABLED" = true THEN 'Enabled'
           WHEN a."IS_ENABLED" = false THEN 'Disabled'
           WHEN a."IS_ENABLED" is NULL THEN 'Disabled'
           END      AS lfs_status
from repository r
         left join "AO_811463_GIT_LFS_REPO_CONFIG" a on r.id = a."REPOSITORY_ID"
         join project p on p.id = r.project_id
where exists(select key_value
             from plugin_setting
             where key_name = 'com.atlassian.bitbucket.server.bitbucket-git-lfs.enabled'
               and key_value = 'true')
order by r.id asc;




Last modified on Mar 28, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.