add .gitignore file, check file is good before while loop