This question has already been answered:

Hello. I just can not configure such a thing: I have a file in the php project with a connection to the database. It stores data for this connection, that is, a host, password, etc. I would not want this data to be in the git repository, but the file itself should be there with other data. I tried to first add a file with false data to the repository, and then exclude it from tracking, but, I understand. that if the file already exists in the remote repository, then you cannot remove it from the index? Or how to do it?

Reported as a duplicate by rjhdby , Sasha Omelchenko , ermak0ff , AK ♦ , Denis Bubnov on Mar 13 '17 at 10:46 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

1 answer 1

git rm file_name 

Then prescribe it in .gitignore

  • Maybe immediately git rm. to register? Then there will be nothing to add ... - SamyRed
  • Please describe the solution in more detail, to make it easier for users to understand your answer. To edit the answer, click Edit . You can also read tips on how to write a good answer . - From the queue of checks - Yuri