Git LFS refused to properly track my large files until it did the following:

Problem

I had problems trying to use git LFS , despite numerous suggestions here about SO, in the Git and GitHub docs and on some Gists, I would run through.

My problem was this:

After completing the necessary steps:

git lfs install git lfs track "<file of interest>" git commit 

I still would not have tracked files. If I performed

 git lfs ls-files 

it will be empty. If I went ahead and performed a push, the transaction would fail, saying the files were too large. (As expected, but I was desperate.)

+5
source share
2 answers

My (original poster) "Solution"

Then I discovered several fixes, some of which seem to be errors, some of which simply were not obvious to me.

  • It seems that to use lfs with an existing repository, a hacking tool or a third party tool such as a BFG converter .

    • I did not want to go along this route, so I just initialized the new repository locally, and then tried to connect it to the real repo.
    • I created a new directory, then git init , etc.
      • In my case, the remote repository was GitHub. So I made all those suitable connections like git remote add origin git@github.com :<my_id>/<my_repo>.git
  • Also, while Git Training Video claims that you can simply specify a folder such as "my_folder/" , I could not get this to work. So I just cleverly used file name extensions to manage things.

    • For example, git lfs track "my_folder/" will not work for me, but git lfs track "*.zip" really worked.
  • I could not correctly identify the LFS files if I did not have the .gitattributes file updated first, and it was sent and dragged this new file to the remote server .

    • git lfs track "*.zip"
    • git add .gitattributes
    • git commit -m "Updated the attributes"
    • git push
    • git add my_large_file.zip
    • git lfs ls-files
      • And here I would make sure I was tracking my_large_file.zip .
    • git commit -m "Now I am adding the large file"
    • git push

It is possible that some of the things work, and I just did them wrong. However, after the witchcraft described above, finally, LFS was hired, so I thought I was passing this data on to others in case someone had the same problem.

+9
source

To track all my_folder files and subdirectories via LFS, you can:

 git lfs track "my_folder/**" 

It worked for me.

The following action now does not work to track the entire my_folder directory:

 git lfs track "my_folder/" 

does not work

+2
source

Source: https://habr.com/ru/post/1243443/


All Articles