Got some important files which you don’t want to share publicly but still want to use github as VCS for your softwares. Crypt-git can help you.
crypt-git is a command line utility written in node.js which enables to encrypt important files when you push them on GitHub repo and decrypt then when you want to work locally on your system. Doing this is very very simple with ‘crypt-git’.
Install the module globally:
$ npm install -g crypt-git
You just need to maintain a file
.cryptfiles where you need to specify the
file name(s) which you want to encrypt.
create .cryptfiles file:
edit .cryptfiles file
See an example here, this encrypts all the files named
amit.txt in the repo.
$ cg push <commit message>
<commit message>is optional.
The above command is equivalent to doing these operations:
git add -A
git commit -m'your message'
git push -u origin master
Now all your important files mentioned in
.cryptfiles file are pushed on your repository in encrypted (and compressed) form.
When you want to work locally with your repository (without any encrypted file) then all you need is:
NOTE: cg is abbreviation for crypt-git
When you perform
cg decrypt, the encrypted file gets decrypted on your local machine.
$ cg push <commit message> // to push with the encrypted content. cg decrypt // to decrypt the encrypted files
To know more read this.
Nothing important here that you don’t already know.
supremebranch creates different .iv file for each encryption.
masterbranch has static .iv file which gets created once (for the first time).
first release (v1.0.0)
- It works fine for all cases except one case which you may need to handle properly.
- If you perform two
cg pushoperations one after the other without making any changes then the content of
.ivfile would get changed which will result in improper decryption thus you may face problem in decompression.
- If you ever encounter any such problem just re-clone the project and do
cg pull. Things will be fine.
Olympian release (v1.5.0)
- This release takes care of commit history, because now every push doesn’t create a new encryption pattern into the file, So all the files doesn’t gets changes. This doesn’t make the commit history improper. To know more about this release see this
Sovereign release (v1.6.0)
- The command
cg pullis replaced with
- In this release
git pullis not being performed because it is not required. The decryption process is done using the
.ivfile, which is available locally (so why to fetch again?), in case the file is deleted somehow, the user is asked to clone the repo and try decrypting again.
- Yet to come.
- Major changes (TODO):
1) Ability to perform encryption of files with match of the regular expressions (this will help encryption of multiple files with same extension and irrespective of their names).
.cryptfilescan take several lines of input and the each file or file path will get encrypted.
Apache-2.0 © Amit Upadhyay
Thank you 🎂 👏