Skip to content

Git crypt

git-crypt

在 git-ops 中使用 git-crypt 保护敏感数据 | Zhu.Yang

git-crypt 对 git 仓库中的数据进行透明的加解密,选择保护的文件在提交时会加密,在检出时会解密。

生成一个密钥使得当前的 git 库可以使用 git-crypt

git-crypt init

检查文件加密状态

git-crypt status

创建 .gitattributes 来指定加密的文件

<file-name-to-encrypt> filter=git-crypt diff=git-crypt

确保将敏感文件移出存储库并提交更改,然后添加 .gitattributes 文件,然后将敏感文件移回存储库。