From e745b557557b808e19509df49352742af25c6201 Mon Sep 17 00:00:00 2001 From: Rodos Date: Thu, 11 Dec 2025 20:55:24 +1100 Subject: [PATCH] fix: replace deprecated git lfs clone with git clone + git lfs fetch --all git lfs clone is deprecated - modern git clone handles LFS automatically. Using git lfs fetch --all ensures all LFS objects across all refs are backed up, matching the existing bare clone behavior and providing complete LFS backups. Closes #379 --- README.rst | 2 ++ github_backup/github_backup.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 9fd35fd..5630681 100644 --- a/README.rst +++ b/README.rst @@ -215,6 +215,8 @@ When you use the ``--lfs`` option, you will need to make sure you have Git LFS i Instructions on how to do this can be found on https://git-lfs.github.com. +LFS objects are fetched for all refs, not just the current checkout, ensuring a complete backup of all LFS content across all branches and history. + About Attachments ----------------- diff --git a/github_backup/github_backup.py b/github_backup/github_backup.py index 0282809..f706741 100644 --- a/github_backup/github_backup.py +++ b/github_backup/github_backup.py @@ -2090,11 +2090,13 @@ def fetch_repository( git_command.pop() logging_subprocess(git_command, cwd=local_dir) else: - if lfs_clone: - git_command = ["git", "lfs", "clone", remote_url, local_dir] - else: - git_command = ["git", "clone", remote_url, local_dir] + git_command = ["git", "clone", remote_url, local_dir] logging_subprocess(git_command) + if lfs_clone: + git_command = ["git", "lfs", "fetch", "--all", "--prune"] + if no_prune: + git_command.pop() + logging_subprocess(git_command, cwd=local_dir) def backup_account(args, output_directory):