Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force push a git lfs file ID

Tags:

git

git-lfs

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...

like image 694
Cyril Duchon-Doris Avatar asked Feb 06 '18 10:02

Cyril Duchon-Doris


2 Answers

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

like image 184
Cyril Duchon-Doris Avatar answered Oct 23 '22 10:10

Cyril Duchon-Doris


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
like image 8
E. Moffat Avatar answered Oct 23 '22 08:10

E. Moffat