I'm trying to push to a second remote that doesn't support Git LFS. Is there a way to disable Git LFS for a specific remote using git config
?
Asked
Active
Viewed 1.4k times
51

amiuhle
- 2,673
- 1
- 19
- 28
-
15Workaround: `git push --no-verify` will skip the pre-push hook which triggers Git LFS – amiuhle Apr 14 '16 at 15:17
-
1I know you can set a separate `lfsurl` for each `[remote]` in your `.git/config` --> did you try just having one without the `lfsurl`? – danf Apr 17 '16 at 06:08
-
1@danf If you don't have it, it defaults to the same server. If you set it to blank, you get a *missing protocol: ""* error. – derobert Feb 25 '18 at 22:15
1 Answers
44
The workaround given by amiuhle works fine for me:
git push --no-verify
It prevents the pre-push hook of git lfs from trying to upload the files. So link-files are committed, but the actual binaries are missing.

Christian
- 13,285
- 2
- 32
- 49
-
1This works for me, but I am curious about the question asked: is there something I can do with `git config` that will make `git push` work like `git push --no-verify` so I can use scripts as-is for pushing all my repos. – Liam Aug 17 '18 at 13:54
-
3I got `LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".` – Avin Shum Jun 15 '20 at 03:24
-
3Note: as stated in the answer, this disables the (client-side) `pre-push` hook, but *not* the (server-side) `pre-receive` hook. Most git servers (e.g. GitLab) implement such a hook to check for missing LFS objects, as reported by @AvinShum – Gerrit-K Mar 05 '21 at 15:06