Roma  Karageorgievich Roma Karageorgievich - 11 months ago 66
Git Question

How to ignore folder in GitHub correctly?

In my

file I added a path to folder I don't want to see in GitHub website:


Then I push this changes:

git commit -a -m "add ignore"
git push origin master

But when I go to site, I still see this folder. How to do it correctly?

Answer Source

You need to remove the folder now that it is in the .gitignore. You can do this by deleting the folder locally, adding changes, commit it and then push it. If you need the folder in your local repository you can then recover it by making a backup, before deleting it.

If you however do not want to remove the folder locally, and delete it just from the remote, you can do:

git rm -r --cached Results/.ipynb_checkpoints/
git commit -m "Removed folder from repository"
git push origin master

More about deleting a file/folder from the remote repository but not locally can be read in this question and answers.