David Torres
David Torres

Reputation: 1767

Git - How can I ignore a file of my repo without removing it from the repository?

I have a config.js file in my repo. After working for a while... I added some sensitive information to that file, so I never commit it.

What I would like to do is to ignore this file, so never gets commited. However, I do not want the file to be removed from the remote repo, as if somebody wants to collaborate, I want them to have the base version of the config file.

I tried .gitignore but the file is still showed as 'modified' when I run a git status. If irrc I tried .git/info/exclude and I had a similar problem.

Also, --assume-unchanged is not intended for that. And it is not guaranteed that your file will not be committed.

Upvotes: 1

Views: 193

Answers (1)

mcserep
mcserep

Reputation: 3299

That's the purpose of having a config.js.sample file with a base configuration which can be customized by anybody by renaming it to config.js. Which won't be committed if you put config.js on the ignore list.

Upvotes: 3

Related Questions