首页 > 解决方案 > 每个遥控器禁用或正确安装 git LFS

问题描述

我有一个配置了两个遥控器的 git 存储库。

其中一个远程是本地裸 git 存储库,通过 ssh 访问(它的 url 是ssh://username@host:/home/username/repo.git),它不支持 git LFS。

是否可以为该遥控器禁用 LFS 并git push发送跟踪文件的原始内容,而不是指针?

我遵循了这些文章的建议,但它们无济于事:

为远程禁用 Git LFS

https://github.com/git-lfs/git-lfs/issues/3665#issuecomment-496549743

命令git push成功,但我有指针文件而不是原始内容:

$ head ./src/LARGE-file.bin
version https://git-lfs.github.com/spec/v1
oid sha256:e4790eb8aeb78cc79ace0f3d9719875d95091fe97969302d6816f64b9f0f8850
size 1430976

总而言之,我的目标是为一个遥控器启用 git LFS 并为另一个遥控器禁用它。

或者,也可以为纯 ssh 远程配置 LFS,我会很感激有关如何做到这一点的建议。

标签: gitgit-lfs

解决方案


The issue here is that what's actually in Git is the content-pointer files.

If you disable LFS for a remote, what you are really doing is saying when I send to the given remote, I don't want to send the real files to the LFS server, I just want to send the content pointers to the Git server.

To send the real files as part of a commit, they must actually be part of the commit. Remember that git push operates on commits, not files. Git-LFS operates on individual files whose content-pointers are stored in the underlying Git repository.

If you make commits that contain the actual files instead of content pointers, and send those commits instead of the commits that contain only content pointers, that would work; but note that this is a different / independent history that cannot easily be reconciled with the LFS-pointer-based history. There is probably no support built in to Git-LFS itself for this, as it would be kind of a nightmare to handle well.


推荐阅读