【发布时间】:2022-10-20 11:55:03
【问题描述】:
我将 Ansible 与 Windows 主机 (VM) 一起使用。
我正在尝试git clone 一个大的内容(实际上使用git lfs)。总共大约15Go
我正在使用git for windows (https://github.com/git-for-windows/git/releases/tag/v2.37.2.windows.2)。
我有以下 Ansible 任务:
- name: Clone repository
ansible.windows.win_command: >
<path/to/git.exe> clone <git-repo>
问题是它总是因错误而失败:
fatal: Out of memory, realloc failed
我尝试增加 Windows VM 内存,或使用git config 设置,如几篇文章中所述,例如:
- remote: fatal: Out of memory, realloc failed on git push with post-receive hook
- git out of memory on checkout
- https://community.atlassian.com/t5/Bitbucket-questions/Message-erro-quot-fatal-Out-of-memory-realloc-failed-quot/qaq-p/894048
但是这些解决方案都不适合我。它总是在相同的点上失败:
"Filtering content: 48% (440/902), 2.11 GiB | 6.70 MiB/s",
"fatal: Out of memory, realloc failed",
"Error downloading object: xxxxxxx: Smudge error: Error reading from media file: write /dev/stdout: The pipe is being closed.: write /dev/stdout: The pipe is being closed.",
"",
"Errors logged to 'xxxx.log'.",
"Use `git lfs logs last` to view the log.",
"warning: Clone succeeded, but checkout failed.",
"You can inspect what was checked out with 'git status'",
"and retry with 'git restore --source=HEAD :/'"
奇怪的是,这个错误只在使用 Ansible 时发生。如果我连接到虚拟机并手动运行完全相同的git clone 命令,一切都会顺利进行。
你有什么想法可以帮助我吗?谢谢
【问题讨论】:
-
您可以尝试将其拆分为两个步骤:(1) 在没有安装 LFS 的情况下进行克隆,以便获得“指针文件”而不是真实文件(使用
--no-checkout跳过无用的签出)。 (2) 安装 LFS 并将其插入下载真实文件。可能首先单独使用--no-checkout可能会避免该问题,但分两步执行意味着Git 可以在没有Git-LFS 包装器占用内存的情况下运行,然后Git-LFS 可以使用内存较少的Git 操作运行. -
这是一个纯粹的 git checkout 问题。删除 ansible 标签。
-
我知道问题来自
git checkout。但是,它只发生在我使用 Ansible 时。我直接在主机上运行时没有这个问题
标签: windows git ansible git-lfs