使用 git-crypt unlock 只解密部分文件而不是整个 repo

Descrypt only some files with git-crypt unlock and not the entire repo

我正在对使用 git-crypt.

git 目录执行稀疏检查

正常 git clone 后跟 git-crypt unlock 有效。

由于我正在 运行 进行 sparse 结帐,我还想执行部分 git-crypt unlock

宁运行后

g sparse-checkout init
g sparse-checkout add <dir1>
g checkout master
g sparse-checkout add <dir2>
g checkout master

注意:g sparse checkout <dir1> <dir2 后跟 g checkout master 不起作用 因为它似乎只获取 <dir2>

我运行git-crypt unlock

然而,这失败得很惨,因为它吐出大量错误,如

error: pathspec 'path/to/some/other/encrypted/file/not/included/in/my/sparse/checkout' did not match any file(s) known to git

有什么处理方法的建议吗?

对此没有直接的解决方案。
可以做的是使用来自 git crypt 的多个密钥,每个稀疏结帐的密钥和整体加密的另一个密钥。
文档:https://github.com/AGWA/git-crypt/blob/master/doc/multiple_keys.md
替代解决方案和我的信息来源:https://github.com/AGWA/git-crypt/issues/155
目前最好的解决方案是使用多个密钥。