Skip to content

Instantly share code, notes, and snippets.

@naure
Created August 2, 2017 16:27
Show Gist options
  • Save naure/828014f15e652f745fb9ac709a0cb9ae to your computer and use it in GitHub Desktop.
Save naure/828014f15e652f745fb9ac709a0cb9ae to your computer and use it in GitHub Desktop.
Commands to encrypt and decrypt secrets in git
# Store encrypted secrets in git.
#
# 1. Put all your keys and passwords in a directory called secrets/
# 2. make encrypt_secrets, and enter a password twice.
# 3. git commit, push, pull, etc.
# 4. make decrypt_secrets, and enter the password again.
#
encrypt_secrets:
tar cz secrets | openssl aes-256-cbc -out secrets.tgz.aes
git add secrets.tgz.aes
decrypt_secrets:
echo '/!\ About to erase any changes under secrets/ !'
openssl aes-256-cbc -d -in secrets.tgz.aes | tar xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment