Skip to main content

The easy way to encrypt/decrypt private files in the git repo.

Project description

git-easy-crypt

The easy way to encrypt/decrypt private files in the git repo.

Install

you can install git-easy-crypt by pip:

$ pip install git-easy-crypt

or download the script directly:

$ sudo curl -o /usr/local/bin/gecrypt https://raw.githubusercontent.com/taojy123/git-easy-crypt/master/gecrypt.py 
$ sudo chmod a+x /usr/local/bin/gecrypt

Usage

gecrypt setkey mysecretkey             Set a secret key for encrypt/decrypt in current repo
gecrypt showkey                        Show secret key
gecrypt encrypt ./path_to_file         Encrypt a file
gecrypt decrypt ./path_to_file.sec     Decrypt a file
version                                Show version
help                                   Show help for commands

Best Practice

Alice, encrypt the secret files and push:

$ git clone https://github.com/taojy123/test
Cloning into 'test'...
...
Unpacking objects: 100% (3/3), done.
$ cd test

$ gecrypt setkey abc123
`abc123` has saved in .git-easy-crypt-key

$ echo MYSECRET=AAA > keys.txt
$ ls
README.md    keys.txt

$ gecrypt encrypt keys.txt 
Encrypt success!
The secret code has been saved in `keys.txt.sec`, and `keys.txt` is ignored by git.
You must keep the secret key `abc123` in mind for decrypt the file in the future!!!
$ ls
README.md    keys.txt     keys.txt.sec

$ git add .
$ git commit -m "add encrypted secret file"
[master 3d8ef6f] add encrypted secret file
 2 files changed, 5 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 keys.txt.sec

$ git push
...
To https://github.com/taojy123/test
   4d86b27..3d8ef6f  master -> master
$ 

Bob, pull and decrypt the secret files:

$ git clone https://github.com/taojy123/test
Cloning into 'test'...
...
Unpacking objects: 100% (7/7), done.
$ cd test

$ ls
README.md    keys.txt.sec

$ gecrypt setkey abc123
`abc123` has saved in .git-easy-crypt-key

$ gecrypt decryptall
`./keys.txt.sec` has been decrypted to `./keys.txt`.

$ ls
README.md    keys.txt     keys.txt.sec

$ cat keys.txt
MYSECRET=AAA 
$ 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for git-easy-crypt, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size git-easy-crypt-1.0.3.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page