git - 每个遥控器禁用或正确安装 git LFS
问题描述
我有一个配置了两个遥控器的 git 存储库。
其中一个远程是本地裸 git 存储库,通过 ssh 访问(它的 url 是ssh://username@host:/home/username/repo.git
),它不支持 git LFS。
是否可以为该遥控器禁用 LFS 并git push
发送跟踪文件的原始内容,而不是指针?
我遵循了这些文章的建议,但它们无济于事:
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,我会很感激有关如何做到这一点的建议。
解决方案
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.
推荐阅读
- sql - 防止在 AWS Glue 中多次处理文件
- windows - 使用批处理脚本在多个文件上搜索文本,如果在其中找到文本,则重命名文件
- python - Pyinfra 缺少位置参数
- android - 以编程方式为 AnimatedVectorDrawable 和 Compat 设置持续时间和 startOffset
- javascript - 我不断收到 TypeError: Cannot read property 'find' of undefined
- python - 有没有办法使用模式匹配回调删除(修改)绘图破折号中的父元素?
- java - 与继承类不兼容的类型
- unity3d - 2个统一的维度滑块
- reactjs - 谷歌身份没有在反应中调用回调
- javascript - 选择下拉项时更改父元素的背景?