Should we include passwords (Database, SSH, etc) on our git repo.
Yes, if you don't want to be changing this AKA consistent throughout every other dev.
No, because now everyone will know them
Even if you delete files on the repo. EX: Delete the password after accidentally commiting the password. This is bad practice.
Use .env files and env variables
- Create a
.env.local.php
- Store it in the root directory (Alongside app, bootstrap, public, vendor folder)
env.local.php
<?php
return array(
'PRODUCTION_HOST' => 'makarios.cloudapp.net',
'PRODUCTION_USERNAME' => 'admin',
'PRODUCTION_PASS' => '123456',
'key' => '',
'keyphrase' => '',
'PRODUCTION_ROOT' => '/var/www/makarios',
);
Add this to your .gitignore
Then you can call upon the values by using the keys returned by the array
If you need the password you can just do: $_ENV['PRODUCTION_PASS']