Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7718609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:12:26+00:00 2026-06-01T03:12:26+00:00

I have a database configuration file, database.yml, which needs to be in Git because

  • 0

I have a database configuration file, database.yml, which needs to be in Git because my clients build server clones the entire repo for testing.

However I also have a copy of this file on my local machine for development, the problem is I want to make changes to this locally and have git ignore these changes i.e. not commit the changes to the repo when changes are made and not overwrite it / give me hassle about it being different when I issue a pull request.

Does anyone know how this can be achieved? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:12:27+00:00Added an answer on June 1, 2026 at 3:12 am

    You shouldn’t be including your real database credentials in version control. Copy your database.yml file to database.yml.example with a blank username/passwword, and add database.yml to .gitignore. Each time you clone, copy database.yml.example to database.yml and put that installation’s specific database credentials into the database.yml copy.

    If you want to avoid having to re-setup your production environment each time you deploy, use something like Capistrano which will let you keep things like config files between deploys, or write your own script which creates a link to a persistent database.yml outside the deploy directory.

    You can also use git update-index --assume-unchanged config/database.yml to cause Git to ignore local changes to that file, but you shouldn’t do this. The correct solution is to keep your real database credentials out of Git.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini (configuration file) where I have mentioned the server name, Database
I have a case where I'm trying to leverage a database configuration file used
I have an application server which connects to a database server. I would like
I have a web application that dynamically loads assemblies based on database configuration entries
I'd like to have a single configuration file and then when I'm creating a
Basically, I have a Sql Server database whose schema changes. When this happens, I
I have an XML file that contains database settings that may change depending on
We often have a lot of cut and paste within a configuration file. For
I have set up some custom symfony project-level settings in the file config/project.yml following
We have a database that has configuration data in. When the applications are run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.