j76goatboy
j76goatboy

Reputation: 445

Push to Github failed because it can't find LFS file?

I'm trying to push local commits to my repository on Github, but I keep getting this error.

Uploading LFS objects:   0% (0/1), 0 B | 0 B/s                                  
open E:\Unity Projects\MysteryNarrative\Assets\NotificationsSamples- 
master\Assets\Demo\Sprites\cookie.png: The system cannot find the path specified.
error: failed to push some refs to 'https://github.com/james-sullivan/MysteryNarrative'
Completed with errors, see above.

Before I got this error, I deleted a bunch of files that were in the project, including the one that it is complaining about not finding. Looking back at the commit where I deleted those files, the Demo\Sprites\cookie.png had been recorded as deleted, so I'm very confused as to why it's still looking for it.

I tried just force pushing it to the repo, but it still came back with this error. I also tried creating and committing a png file called cookies at that specified location, but it still wasn't happy.

I'm also using the beta version of the Sourcetree GUI on Windows in case that makes any difference.

I'm not very experienced with source control and any help would be greatly appreciated :)

Upvotes: 0

Views: 1660

Answers (1)

Ben W
Ben W

Reputation: 1040

When you use LFS, the files specified are not controlled through git- only a pointer file.

Can you switch to command line and run the following commands?

git lfs status
git lfs push origin <branch-name>

If that does not work, try checking out an older commit - before you deleted the files

git checkout <commit-id>
git lfs checkout
git lfs status

If the cookie.png file exists and you can open it, then you should be able to push it to the server.

If it does not, then you may have to remake the image/copy it back into the repository.

Note: I have not used sourcetree, so someone else may be able to provide better feedback

Upvotes: 1

Related Questions