user40780
user40780

Reputation: 1920

git checkout lfs files immediate makes all lfs files modified

Essentially, I just git clone and checkout

git lfs clone https://github.com/**/**.git
git checkout -b add_test_for_multi_portfolio  origin/add_test_for_multi_portfolio

Then, all my lfs files are considered modified when doing

git status

This is incredible annoying... Any suggestion?

Upvotes: 1

Views: 1993

Answers (2)

user40780
user40780

Reputation: 1920

Thanks for the answer... Anyway, I resolve this issue by updating both git and git-lfs. And then reconstruct a repo, ensuring that .gitattributes contains all the file types that are needed for git-lfs to track and only after that add the corresponding files to git.

Upvotes: 1

VonC
VonC

Reputation: 1324268

the key error is that once I git checkout a new branch, all the lfs files are considered modified

Check first if you have the settings core.autocrlf set to true.

If yes, type:

git config --global core.autocrlf false

Then try and clone again.


Regarding LFS itself, see issue 2435:

If you see something like:

test-lfs - master $> git lfs pull
Git LFS: (19 of 20 files) 196.82 MB / 197.08 MB
Expected OID 7633170d50ca7cfc690f1fca4dde1adc73ef0130b75fc1cb7d4517b1cfdcc5b7, got d10e697da5588ec5c1d580a8c5ee57d105fdfdaadfd9674fef73ba628cf9655c after 9977 bytes written
error: failed to fetch some objects from 'https://****@bitbucket.org/****/test-lfs.git/info/lfs'test-lfs - master! $> git lfs status                                                                                                                                                                                                                                                                [ ruby-2.3.1p112 ]
On branch master
Git LFS objects to be pushed to origin/master:


Git LFS objects to be committed:

        files/default/firmware/bxtgucver87.tar.bz2 (LFS: fc1eb19 -> Git: fc1eb19)
        files/default/firmware/kbldmcver101.tar.bz2 (LFS: 2dfb6b1 -> Git: 2dfb6b1)
        files/default/firmware/kblgucver914.tar.bz2 (LFS: 54a8350 -> Git: 54a8350)

This can happen for one of two reasons:

  • LFS's filters aren't installed. LFS relies on Git invoking a program called git lfs filter-process in order to convert the large files in your working tree to small files in your history.
    You can double check that these are installed by running:

    $ git lfs install
    $ git config filter.lfs.process # <- should be "git-lfs filter-process"
    
  • Your .gitattributes aren't invoking the Git LFS filters, which means that the files aren't being converted.
    You can double check this by inspecting the contents of your .gitattributes, and running git lfs track if the pattern you want to be tracked isn't.

Upvotes: 2

Related Questions