Modify .gitignore.
Optimize memory useage and add error report if path is not exist.