Add *, but sibling is being ignored
How can I add everything and just skip the thing being ignored?
- git: How to ignore all present untracked files?
- Show all ignored files in git
- Removing files from githubs repository but not locally
- How to Git Ignore Contain “tiu” Word Files
- git ignore specific directories exception
- .gitignore is whitespace sensitive?
$ git add assets/* The following paths are ignored by one of your .gitignore files: assets/avatars Use -f if you really want to add them. fatal: no files added
2 Solutions collect form web for “Add *, but sibling is being ignored”
According to documentation, the
--ignore-errors flag would just make the command work as you’d like.
If some files could not be added because of errors indexing them, do not abort the operation, but continue adding the
others. The command shall still exit with non-zero status. The
configuration variable add.ignoreErrors can be set to true to make
this the default behaviour.
This doesn’t work in this case, I guess because the
assets/* parameter is expanded by the shell so that the actual parameters received by
git add are the expanded list of files and directories and so the failure is explicit.
I’ve tried this command with good results:
$ git add assets
It works even without the option
--ignore-errors because it doesn’t try to add the ignored directory below
When you use the wildcard
*, it will be expanded by your shell on Unix systems. Thus, running
git add assets/* is the equivalent of explicitly adding files beneath
For example, if I have two files:
git add assets/* is expanded to:
git add assets/file1.txt assets/avatars/file2.txt
So git complains that you are instructing it to add an ignored file. If you want to avoid this message, you can quote the
* to allow git to do the globbing. This will instruct git to expand your paths, paying attention to the
.gitignore file. For example:
git add assets/\*
Produces no warnings and stages only the appropriate files, in this example,