3

I have a git repository both on GitHub and on my private Amazon instance and with a unique commit I update both.

There is a way to commit the file database.yml only to my private repository and not on GitHub?

If could help, I'm using Capistrano for deployment.

2 Answers 2

3

In the past days I found no answer to this question, but then I solved my problem, so I'll say what I've done to have things working.

Since I don't have to modify the file database.yml, I solved my problem manually copying it to my Amazon instance and adding it to .gitignore.

Then, I added a task in deploy.rb to link database.yml to the current directory of deployment

# copy db config
after "deploy:update_code", :copy_db_config
desc "copy db config file"
task :copy_db_config do
  run "ln -s ~/path/where/I/copied/database.yml #{release_path}/config/database.yml"
end

Hope this help.

Sign up to request clarification or add additional context in comments.

2 Comments

That's also what I have been doing: tigraine.at/2011/09/25/…
@Tigraine Great :) Unfortunately I didn't see your post in the past days.. I could have save a lot of time
0

Another solution is provided here. If you previously define environment variables you can use them in the databases.yml file.

username: <%= ENV['POSTGRES_USERNAME'] %>
password: <%= ENV['POSTGRES_PASSWORD'] %>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.