elasticdog / transcrypt

transparently encrypt files within a git repository
MIT License
1.46k stars 102 forks source link

How to handle hidden file in crypt ? #124

Closed rioukkevin closed 3 years ago

rioukkevin commented 3 years ago

Hi, I don't find information on how to handle file like .npmrc at project root in transcrypt, does anyone know how ? Thanks for your help Have a nice day and be happy :wink:

jmurty commented 3 years ago

Hi @rioukkevin if you want to encrypt files like .npmrc with transcrypt you add a matching "crypt" pattern to the .gitattributes file.

Add a line like the following to .gitattributes, then git add .gitattributes .npmrc and commit to (re-)add these files to Git:

# In .gitattributes file
.npmrc filter=crypt diff=crypt merge=crypt

Run git ls-crypt to make sure the files you want to encrypt are actually being handled by transcrypt.

Be careful when adding patterns for dot-files not to add accidentally encrypt file paths that are important to Git or transcrypt. Do not add a pattern like .* to .gitattributes. Adding hidden file patterns one-by-one is probably safest.

rioukkevin commented 3 years ago

Thank you, I'll try it