Do I need to add .gitignore to the version when I push it remotely?

my .gitignore was modified when I used git to push the local repo to the remote repo.

< kbd > < / kbd >

excuse me, do I need to add .gitignore to the version when I push?

Git
Mar.10,2021

if your .gitignore file has been modified, it is necessary for push to push it to the remote end.


if you make a change, of course you have to push it up, otherwise, the next time someone pulls the code down from the remote warehouse, you can't. Gitignore can't take effect, so why should there be gitignore?? For example, the node_modules folder, if you add a dependency to your package.json, then you install it, but do you want to upload the new package from node_modules to the remote warehouse? No, because someone else just needs to come in and install a new package.json, so the .gitignore file is designed to configure the files or folders you want to ignore when uploading a remote repository.


need it. Gitignore means that your git does not version some files, but the .gitignore file itself needs to be push.
otherwise you can change the clone project on another machine, make changes, and then rewrite .gitignore.

Menu