Reputation: 2118
I am developing a Ruby on Rails application, using git for synchronising code between stakeholders. The application has the ability to send emails. Each stakeholder has his own SMTP provider which is defined in config/initializers/smtp.rb
during installation.
ActionMailer::Base.smtp_settings = {
address: "smtp.emailme.com",
port: 587,
domain: "emailme.com",
authentication: "plain",
enable_starttls_auto: true,
user_name: "[email protected]",
password: "Password"
}
The .gitignore file is defined as:
*.rbc
capybara-*.html
.rspec
/log
/tmp
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html
## Environment normalization:
/.bundle
/vendor/bundle
# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset
Gemfile~
config/initializers/smtp.rb
.gitignore files are identical on Github and on my computer. I tried to specify
config/initializers/smtp.rb
or
/config/initializers/smtp.rb
But whatever, the smtp.rb
file on my computer gets overwritten with the file on Github. And it's the same the other way round.
What did I miss?
Upvotes: 0
Views: 553
Reputation: 2434
.gitignore will tell git to ignore changes to files that are not currently being tracked by git.
Run git rm --cached config/initializers/smtp.rb
to stop git from tracking future changes to the file.
Create a config/initializers/smtp.template.rb
with dummy values, and commit + push your changes.
Direct any new stakeholders to run cp config/initializers/smtp.template.rb config/initializers/smtp.rb
and update the file when setting up their development environment.
Upvotes: 0
Reputation: 875
As mentioned by @oliver, the file should not exist on git. You can remove the file from git by doing
git rm --cached config/initializers/smtp.rb
git commit -m "Removed config file from repo"
git push
Please do note --cached
, it is very important otherwise you can lose the file from you local directory. This option will remove the file only from repo.
See: Remove directory from remote repository after adding them to .gitignore if you want to Add directory to .gitignore
Thanks!
Upvotes: 1