在 Windows 10 上 运行 `chef install` 时,如何解决 "Filename too long" 错误?

How do I get around "Filename too long" error when running `chef install` on Windows 10?

我正在从 berkshelf 过渡到 Policyfile 工作流,在我尝试解决所有依赖关系之前,一切 运行 都很好。我的两个依赖项来自 git,因此当我在食谱目录中 运行 chef install 时,出现以下错误:

Error: Failed to generate Policyfile.lock
Reason: (CookbookOmnifetch::GitCommandError) Git error: command `git reset --hard 7e5e4bccf57718cacc246f1b4d501ff7de8ac13d` failed. If this error persists, 
try removing the cache directory at 'C:/Users/pcummuskey/AppData/Local/chefdk/cache/.cache/git/780b7dbee933c3a9efbfd3898d54cdf72784fa7e'.Output from the command:

error: unable to create file test/kitchen/.kitchen/tmp/librarian/cache/source/chef/site/877777683730772c36b1e6a3fc3aa2c3/windows/version-uri/a3432e93fb3c21cb7111fde71e435661/package/files/default/handlers/windows_reboot_handler.rb: Filename too long
Checking out files: 100% (389/389), done.
fatal: Could not reset index file to revision '7e5e4bccf57718cacc246f1b4d501ff7de8ac13d'.

不出所料,删除缓存文件夹对问题的影响为零。我正在检查我是否可以让它在 ubuntu 子系统 and/or docker atm 中工作,但能够 运行 它会很好本地 Windows.

使用 Git for windows 安装程序中打包的 "git bash" (MINGW64) 我没有遇到这个问题。

举个例子:

$ pwd
/c/Users/foobar/AppData/Local/chefdk/cache/.cache/git/13036489648c6f8811262c6a50ff6b03da2395b7/4416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f6/4416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f64416ca3886d025b3ead519f1ee53af03ecb630f61

设法解决了这个问题,方法是创建一个本地 cookbooks 文件夹并检查那里的依赖项并按路径引用它们。它不漂亮,但它确实有用。