16

Using git lfs, how can I force push a file ID that I know I have locally but that for some reason did not get pushed to the server ?

ie, on my build system I have errors like

Git LFS: (0 of 15 files, 1 skipped) 0 B / 1.10 MB, 4.30 MB skippedGit LFS: (15 of 15 files, 1 skipped) 1.10 MB / 1.10 MB, 4.30 MB skipped [f54812afe7bfdff14c154af6adb7cc4cb425763c1bdaa5fcf0bcea4fd2da7ab9] Object does not exist on the server: [404] Object does not exist on the server

So I know I just need to push this file whose ID is f5481... but what's the command to do that ? git lfs push doesn't work I have to force the sync on that specific file ID

I remember finding that magic command once lost in some github issue but I have lost it and the man documentation doesn't seem to be helpful...

Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164

2 Answers2

18

I managed to trigger some extra documentation somehow.... the syntax is actually

git lfs push origin --object-id [ID]

And it will force sync an object that a simple git lfs push would not

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164
9

I had errors on my build system after migrating a repository and it's pipeline to a new remote. I deleted the repository on the old remote before migrating the LFS data (which I forgot existed). When the pipeline ran, I was seeing errors such as

fetch: Fetching reference f0e482d67ea35e173e15a22c0bacb37f2c059365
[b898bde8bb8ee3ee58390ec930e8608568920f61cc9954f198bdacdf79e0d7a8] LFS object not found: [404] LFS object not found
[112e9f3c1dba98d5cafcaadbf2a34dda733a4175632c0d4ba3dbfc590d95ffd4] LFS object not found: [404] LFS object not found
[dd8066b545c4fb09057ace1cf6c6fb8df41b89647c33b5f071d38255da7539ed] LFS object not found: [404] LFS object not found
error: failed to fetch some objects from '<redacted>.git/info/lfs'
##[warning]Git lfs fetch failed with exit code 2, back off 5.225 seconds before retry.

Fortunately, I had the LFS data locally and was able to resolve via:

git remote rm origin
git remote add origin <new_remote_url>
git lfs push origin --all
E. Moffat
  • 3,165
  • 1
  • 21
  • 34
  • I had the same problem and this was really helpful. I think that it occurred when I changed the name of my project in Azure DevOps and then tried to do a new clone. My guess (I haven't done any testing) is that the lfs files weren't moved to the new path along with the rest of the repo. Just one to maybe be aware of for anyone else in the same position. – Brad Jan 06 '22 at 10:27