DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for backup the .env files to git/gist/dropbox in school way!

backup the .env files to git/gist/dropbox in school way!

Hi guys...

Here is a little tip that I like.

Sometimes we need to save the local.env, prod.env file or the stg.env file ... But you don't look where is the best place to backup it .. adding to git it's not a good idea because you are storing secrets is very dangerous...

exists projects like git-secrets1, but in my opinion, it's another layer of knowledge you need to dominate.

let's keep it simple:

cp .env local.env
gpg --armor -c local.env # enter a password
ls local.env.asc # file encrypted created
Enter fullscreen mode Exit fullscreen mode

with that you have a file encrypted symmetrical and it can be stored on your:

$ git add *.asc # your git
$ cp *.asc ~/Dropbox # your dropbox
$ gh gist create local.env.asc # to gist 
Enter fullscreen mode Exit fullscreen mode

For decrypt:

gpg -d local.env.asc # entering the password

Enter fullscreen mode Exit fullscreen mode

When your coworkers saw that they will say:

what are you doing? soo old school!!

oldschool

Top comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.