Encrypt sensitive content with git-crypt

Encrypt sensitive content with git-crypt

Instructions:

1. Install the git-crypt command Download address: https://github.com/oholovko/git-crypt-windows/releases

Copy git-crypt.exe to the Git installation directory: XXX\Git\ cmd

2. Generate the key

Go to the local project directory, open Git Base Here, execute git-crypt init,

Note: Only those who manage private keys execute this command to generate a unique private key to prevent errors caused by encryption of multiple private keys

3. Create .gitattributes, manage encrypted files

secretfile filter=git-crypt diff=git-crypt

*.key filter=git-crypt diff=git-crypt

secretdir/** filter=git-crypt diff=git-crypt

4. Push .gitattributes to the server

5. Export the key and send it to colleagues in need

git-crypt export-key git-crypt-key

6. Decryption

Enter the project directory, open Git Base Here, and execute git-crypt unlock git-crypt-key

 

Using this method for file management can ensure security. Only relevant personnel in the team can see the content of civilized text. Decryption only needs to be performed for the first time, and there is no change after that. If you directly change the file, git push will automatically encrypt, and git pull will automatically decrypt.

Related: Encrypt sensitive content with git-crypt