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.

Source Distribution

git-easy-crypt-1.0.3.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file git-easy-crypt-1.0.3.tar.gz.

File metadata

  • Download URL: git-easy-crypt-1.0.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.14.0 CPython/2.7.12

File hashes

Hashes for git-easy-crypt-1.0.3.tar.gz
Algorithm Hash digest
SHA256 25d93d36d39c75350ea28e8fafe9514cd493a026cabc1e13b8e4b186ee27f2b0
MD5 789d507f4f9cbbee7a84265a84c0ba3e
BLAKE2b-256 6ea93002b3c4fef3b1c19bdca2b081083bbca0d76904d69b9c373c554ec8c318

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page