How to remove the message about initializing Git LFS when cloning a repository?

258 Views Asked by At

A message about initializing Git LFS (see below) comes up when using GitHub Desktop to clone a repository that has previously used Git LFS. How can I remove this message?

This repository uses Git LFS. To contribute to it, Git LFS must first be initialized. Would you like to do so now?

    [path to repository]

A screenshot containing the error message above. A pop-up in the GitHub desktop with the message above and the following options: "Not Now", "Initialize Git LFS"

For context, I would like to prevent this message from popping up as the repository has not used Git LFS in a long time.

What I've tried

  • git-lfs migrate export

    The export mode migrates Git LFS pointer files present in the Git history out of Git LFS, converting them into their corresponding object files.

    This is the most promising because it seems to be the intended method. However, cloning the repository after following the steps below resulted in the same message being displayed.

    git lfs migrate export --everything --include='*'
    git push --force --all
    
  • git-lfs — Simple steps to uninstall Git LFS from your repository

    The basic steps this solution are as follows:

    1. git lfs uninstall
    2. recommit lfs files to restore them
      1. git lfs ls-files
      2. For each files
        1. git rm --cached myfile.psd
        2. git add myfile.psd
      3. `git commit -m "restore files from lfs"
    3. remove lfs .gitattribute entries

    On step (2), running git lfs ls-files lists nothing. For step (3) .gitattributes already has nothing for Git LFS, so there is nothing to remove. In the end, no changes are made, and if I clone the repository again with GitHub desktop, the problem persists...

  • BFG Repo-Cleaner

    Checking my tracked file sizes with git ls-files | xargs du -sh and deleting blobs above that size with bfg --strip-blobs-bigger-than [size] [your-repo].git works great except there is a large file in the project history that should remain tracked. This approach may work if there was a good way to exclude a file from bfg --strip-blobs-bigger-than. It's also not clear whether this would help remove the dependency on Git LFS.

0

There are 0 best solutions below