0

I am working in Ruby and want to ignore my config files when I pull from Github.

The error I am receiving is: "error: Your local changes to the following files would be overwritten by merge: config/database.yml"

Things I have tried:

1) I added the file paths to my .gitignore located in my application root.

2) I added the file paths to my global .gitignore

3) I ran git update-index --assume-unchanged /config/database.yml from my application root

4) I ran git update-index --skip-worktree config/database.yml from my application root

I have multiple instances of the same application in several different folders on my computer. The other instances of the application respect the assume-unchanged command. Im not sure what I am missing.

Peter Black
  • 1,142
  • 1
  • 11
  • 29

1 Answers1

0

Consider stashing your local changes before pulling:

git stash
git pull
git stash pop

It is possible that you have merge conflicts if the files you are stashing are changed on the origin.

sorpha
  • 413
  • 5
  • 8
  • Sorry if I was unclear, the remote config files will always be different. I want to always ignore the remote files. It works on other branches. Just not this one. If I stash/pull/pop commit will I have to do that for each pull? – Peter Black Mar 23 '16 at 16:49
  • Is the config file something that needs to be in the repository? – sorpha Mar 23 '16 at 16:52
  • The config files store sensitive information that is different between developers. We do not store this information on Github. The version of the file on Github is essentially the same file with no values. – Peter Black Mar 23 '16 at 17:01
  • The usual (and, if you ask me, correct) way to solve this is to store e.g. `config/database.example.yml` in the repo, and then when a developer clones the repo they just copy it to `config/database.yml` and make their changes. This way the file in the repo never conflicts with the local file. – Jordan Running Mar 23 '16 at 17:10
  • Figured it out. Some one had committed their config files by accident. Which set the index for those files ahead of my local. Seems like a bug but is probably intended functionality. – Peter Black Mar 23 '16 at 17:12
  • Using stash pop let me get past this and have it work as usual. – Peter Black Mar 23 '16 at 17:12