-2

I'm trying to figure out why git does not ignore a directory (virtual environment). Before adding and pushing files, I've created a .gitignore file which contains the line: venv/

Then I did:

git add .
git commit
git push -u origin --all

As you can see, it's there: enter image description here

Why is the directory not ignored, and how can I ignore it?

Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
Milano
  • 18,048
  • 37
  • 153
  • 353
  • 5
    http://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository – Tacocat Mar 05 '16 at 13:01
  • @Tacocat I did this and venv is still there. git rm -r --cached . ; git add . ; git commit -> nothing to commit, working directory clean – Milano Mar 05 '16 at 13:14

1 Answers1

1

Remove the folder from being tracked locally...

git rm -r --cached folderName
Koreys
  • 117
  • 1
  • 7
  • I did this and venv is still there. git rm -r --cached . ; git add . ; git commit -> nothing to commit, working directory clean – Milano Mar 05 '16 at 13:19
  • Manually delete "venv" from github. Make some changes to your local repository and push to Github. "Venv" should not reappear... – Koreys Mar 05 '16 at 15:32
  • 1
    Also `git add .` will not ever delete files, only add changes... Try `git add --all` then commit and push. the `--all` option will stage deletions. – Koreys Mar 05 '16 at 15:33