Answer the question
In order to leave comments, you need to log in
What is my mistake when using gitignore?
I need to exclude the config/db.php file from the future repositories of the project, which already has pushes.
I added a line to .gitignore (in the root of the project). However, adding the db.php
file is not excluded (the project folder path is replaced by ...):
...>git reset HEAD config/db.php
Unstaged changes after reset:
M config/db.php
...>git status
On branch HW4
Changes to be committed:
(use "git restore --staged ..." to unstage)
modified: .gitignore
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
modified: config/db. php
...>git add :/
warning: LF will be replaced by CRLF in config/db.php.
The file will have its original line endings in your working directory
...>git status
On branch HW4
Changes to be committed:
(use "git restore --staged ..." to unstage)
modified: .gitignore
modified: config/db.php
Answer the question
In order to leave comments, you need to log in
because you need to specify not only the file, but also the path to it, i.e. /config/db.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question