git USES.gitignore Settings do not work or do not work

  • 2020-06-03 06:59:36
  • OfStack

Accidental problems are recorded as follows:

Usually when we're working on the push project, we have some configuration files or local files that we don't want to upload to the server

At this point we're going to go through the.gitignore file

1. Generally set it like this:


Notice that config.* config. py are defined twice?

The idea is to screen all config files

But found it didn't work, config. py file was uploaded in the same way, 1 at first thought it was the wrong wildcard, or how, and wrote a direct file name way

No, still upload.

It looks like the.gitignore setting is not working or not working (the contents of the desired screen will not fall off)

Very troublesome.

Later search the Internet 1 circle, I encountered this problem more than one person, with this command to clear the cache,.gitignore changes to the Settings to take effect.

git rm -r --cached .

Related articles: