Git error: Encountered 7 file(s) that should have been pointers, but weren't

encountered 7 file(s) that should have been pointers, but weren t
git lfs migrate import
git encountered 2 files that should have been pointers but weren t
git encountered pointers
git lfs encountered 1 file(s) that may not have been copied correctly on windows
git large binary files
pointer file error: unable to parse pointer at
git lfs prune

How to clean repo, if staged files marked as modified?

After

git reset --hard

I get

Encountered 7 file(s) that should have been pointers, but weren't:

git clean -fdx

doesn't help too.

Like Travis Heeter mentioned in his answer, Try the following command sequence:

git lfs uninstall
git reset --hard
git lfs install
git lfs pull

In case if this is not working (because this was not working for me), the following hack may work:

git rm --cached -r .
git reset --hard
git rm .gitattributes
git reset .
git checkout .

This worked for me!

Encountered 1 file(s) that should have been pointers, but weren't , Encountered 1 file(s) that should have been pointers, but weren't #1939. Closed i had this problem and git lfs migrate import --include="*.file extension that is the problem file " worked! Hemaolle commented on Feb 7 •. $ git co [filename] Updated 1 path from the index Encountered 1 file(s) that should have been pointers, but weren't: [filename] After much searching, I found an old GitHub issue which described my problem, but none of the solutions worked, or seemed feasible.

I had this exact error with some files stored with git-LFS and solved it the same way I've solved a linending induced borked index .

Clear the cache and do a hard reset:

git rm --cached -r .
git reset --hard

This was significantly faster than a fresh clone for me due to the huge git-LFS files in my repo.

Make it easier to recover from "file(s) that should have been pointers , If files should have been added to Git LFS according to the .gitattributes pattern kind of message: Encountered 1 file(s) that should have been pointers, but weren​'t: test_new. This would not fix the problem for older commits but it would unblock the user and fedde-s mentioned this issue on Jun 7, 2018. Encountered 1 file(s) that should have been pointers, but weren't I just had to git rm the file and commit/push (or probably git add, but I didn't want to add it to lfs), otherwise I was caught in a weird merge hell loop, where I could never rebase --continue or --skip.

This can happen when you do a checkout that contains files which should have been been tracked by LFS as specified in .gitattributes but somehow they've been committed directly instead. Most likely you have another program managing your repository such as a git GUI or IDE.

This can be frustrating because these files appear out of nowhere and prevent you from making checkouts. As soon as you stash your changes they return! If you get stuck in this situation, a quick fix is to commit these changes on a temporary branch so that you can checkout again.

To genuinely fix this problem, make sure you've committed the files as LFS pointers. This should be as simple as using git add. Check your work using git lfs status before committing. git lfs ls-files will show what files LFS is managing.

git lfs status is misleading since it reads Git LFS objects to be committed when it really lists all changes. Files that you expect to be tracked by LFS should read something like (LFS: c9e4f4a) or (Git: c9e4f4a -> LFS: c9e4f4a) and not (Git: c9e4f4a).

By way of example, I found this to be a problem when adding image assets through Xcode 9.2 where I added "CalendarChecked.png" which it automatically added:

$ git status
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    new file:   Example/Assets.xcassets/CalendarChecked.imageset/CalendarChecked.png

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   Example/Assets.xcassets/CalendarChecked.imageset/CalendarChecked.png

$ git lfs status

Git LFS objects to be committed:

    Example/Assets.xcassets/CalendarChecked.imageset/CalendarChecked.png (Git: c9e4f4a)

Git LFS objects not staged for commit:

    Example/Assets.xcassets/CalendarChecked.imageset/CalendarChecked.png (File: c9e4f4a)

$ git add Example/Assets.xcassets/CalendarChecked.imageset/CalendarChecked.png`
$ git lfs status

Git LFS objects to be committed:

    Empty/Empty/Assets.xcassets/CalendarChecked.imageset/CalendarChecked.png (LFS: c9e4f4a)

Git LFS objects not staged for commit:

$

Fixing files that should have been pointers in LFS but weren't , There is a relatively easy fix for a message from git lfs like: Encountered n file(s) that should have been pointers, but weren't If the files in  There is a relatively easy fix for a message from git lfs like: Encountered n file(s) that should have been pointers, but weren't. If the files in question are already on a remote and you don't want to rewrite history, run: git lfs migrate import --no-rewrite path/to/file.ext This will create a new commit moving path/to/file.ext to LFS.

Recovering From a File That Should Have Pointers in Git, Recovering From a File That Should Have Pointers in Git few other people have been working on and I ran into a problem trying to update index Encountered 1 file(s) that should have been pointers, but weren't: [filename]. And, assuming I migrated and cloned on Windows, in Git Bash, COPYING.LIB should remain tracked as Git LFS - as per *.lib in my .gitattributes - even if practically it makes little sense. But, for some reason it is not and clone issues Encountered 6 file(s) that should have been pointers, but weren't. What am I missing in my reasoning?

Since git lfs 2.5.0, there is a new command available that makes this easier (docs):

git lfs migrate import --no-rewrite "broken file.jpg" "another broken file.png" ...

This "migrates" files to git lfs which should be in lfs as per .gitattributes, but aren't at the moment (which is the reason for your error message).

--no-rewrite prevents git from applying this to older commits, it creates a single new commit instead.

Use -m "commitmessage" to set a commitmessage for that commit.

GIT Gotchas and other things that make you cry – Paurian Café, How to clean repo, if staged files marked as modified. after. git reset --hard. I get. Encountered 7 file(s) that should have been pointers, but weren't: git clean -fdx. Encountered 1 file(s) that should have been pointers, but weren ' t: test_new.jpg Run the following command to fix the problem: git lfs migrate import --no-rewrite --include="test_new.jpg" I plan to work on this as soon as I find some time.

Paul E. Johnson 2016-10-10 update 2018-01-30 , Encountered x file(s) that should have been pointers, but weren't caused this problem, the result is that nobody could merge master into their  packoman changed the title How to resolve issue with "Encountered 1 file(s) that should have been pointers, but weren't" How to resolve the issue "Encountered 1 file(s) that should have been pointers, but weren't" Jan 25, 2018

Fix git-lfs user error - git-lfs - html, Git LFS (also referred to as "git-lfs") keeps binary files in a separate storage location. Review files incorporated by Git LFS now $ git lfs ls-files 7. git lfs env # Clone a Git LFS capable repository: Networking Problem Ordinarily, it should local branch) Encountered 1 file(s) that should have been pointers, but weren't: 47. This tells git that file.ending should not be considered a text file the files in Alice's and Bob's working (s) that should have been pointers, but weren't. 7.

Encountered 3 file(s) that should have been pointers, but weren't, (use "git pull" to update your local branch) Encountered 1 file(s) that should have been pointers, but weren't: 47. If there is no conflict, do following: git push origin +test Step 7: And then there is no conflict between test and master. You can  49 Git error: Encountered 7 file(s) that should have been pointers, but weren't 25 cmake execute_process() always fails with "No such file or directory" when I call git 20 'docker -v' bind mount is not working any more on Windows 10

Comments
  • That error message sounds like something you would get from git-lfs. I don't actually use git-lfs so I'm not sure about this (nor what to do about it), but if so, maybe the git-lfs tag would be good.
  • yes, lfs is used
  • @KateZz did you ever find an answer to this? We use git-lfs as well and I just checked out a branch and got that that error.
  • After battling with this across different branches and doing things like making temp branches and committing the problem file to those instead, I still found I had one branch left with a Unity asset file stuck behind. This method worked brilliantly.
  • I needed to do a merge with another branch, but could not get rid of those non-pointer files. Driving me crazy... So, I did a git lfs uninstall, git reset hard <commit>, git merge <branch>, git lfs install and git lfs pull. Finally :). Thanks.
  • Ops, my previous comment should have said git reset --hard... No way to edit in Stackoverflow after a while, sigh...
  • It worked for me as well! Magic?!?!
  • This didn't work for me, but the second code block of AnsarAdimu's answer did. Didn't try the first code block of their answer because uninstalling git lfs seemed a bit much.
  • This solution worked for me. I originally found it from this blog post: tech-notes.maxmasnick.com/…
  • This is the correct answer, everything else failed for me.