I have accidentally included a folder in my Git repository, that I don’t want to include in source control. I wanted to remove it from the Git index, but not from the local hard drive.
The solution is the following command
git rm -r --cached myFolder
If the folder name contains spaces enclose it in quotes "my folder"
This will remove the folder from the Git repository, but leave it on the local drive.