Describe your problem
During the development process, some files were not ignored at the time and were added to git (configuration file config.php). Now they need to be deleted from git.
Paste the relevant code
$git rm --cached /config/config.php
Paste the error message
fatal: Could not switch to 'D:/Program Files (x86)/Git/config/': No such file or directory
Executing the command git parses the path directly from the directory where the command is located, instead of parsing the path from the warehouse directory, so this problem occurs.
I have used this command before without any problems. I want to know how to solve it?
Sometimes we have submitted the file before adding the .gitignore file. .gitignore can only ignore files that have not been tracked (files that have never been added or committed since they were added). If some files have been included in version management, modifying .gitignore is invalid. Just need to execute:
/config/config.php
It is not the file in the config directory in the current directory, but the config directory in the root directorychanged to
The dot represents the current directory
Of course, it’s okay if you don’t add
./
, the default is the current directoryFollow the above method and it will prompt that the file cannot be found in the index