Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding my sensitive information (e.g. password) from github

I just set up Devise (rails authentication plugin) to send a confirmation email upon sign up. This involved my putting the following into my environment.rb file:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
   :tls => true,
   :address => "smtp.gmail.com",
   :port => 587,
   :domain => "gmail.com",
   :authentication => :login,
   :user_name => "[my email]",
   :password => "[my pass]"
 }

I obviously don't want to push this up to github with [my pass] just sitting there. Is there a standard practice here?

like image 216
jyli7 Avatar asked Nov 18 '11 23:11

jyli7


People also ask

How do I remove sensitive information from GitHub?

If you commit sensitive data, such as a password or SSH key into a Git repository, you can remove it from the history. To entirely remove unwanted files from a repository's history you can use either the git filter-repo tool or the BFG Repo-Cleaner open source tool.

Is GitHub safe for privacy?

Privacy and data sharingPrivate repository data is scanned by machine and never read by GitHub staff. Human eyes will never see the contents of your private repositories, except as described in our Terms of Service. Your individual personal or repository data will not be shared with third parties.

Is GitHub safe for passwords?

If you move your private key to each of your computers that use pass, then you can just pull your pass repo from github and use the private key stored on those computers individually. Now they'll all stay synced and safe.

Can you view GitHub secrets?

No. Once written to GitHub, secrets have their value hidden in both web interface and the CLI. The only way to access the secret value is to use it in a GitHub Action.


1 Answers

The standard is to put your configuration settings in one YAML file which isn't included in your repo.

Then you simply get the data from it.

Check Railscast "#85 YAML Configuration File" to see it in action.

like image 131
apneadiving Avatar answered Sep 29 '22 17:09

apneadiving