To solve your .gitignore issue, I would suggest the following steps:
First and foremost, commit and push any changes you have made.
Then, in the directory of your project in the terminal enter the following commands:
git rm -rf --cached .
git add .
Sourced from here.