0

I'm trying to setup a .gitignore file to exclude a folder from my git repo, but I can't seem to figure it out.

I want to exclude the folder named Yarn in base directory.

.gitignore:

Yarn/

But the folder stills exist in my repo when viewing it on github.

Have I misunderstood something and this is not how to use .gitignore?

phd
  • 82,685
  • 13
  • 120
  • 165
SteinTheRuler
  • 3,549
  • 4
  • 35
  • 71
  • Possible duplicate of [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – phd Dec 15 '18 at 10:14
  • https://stackoverflow.com/search?q=%5Bgitignore%5D+forget+tracked+files – phd Dec 15 '18 at 10:14

1 Answers1

1

.gitignore does not ignore files that are already committed and the fact that you see this folder in GitHub suggests that it was committed in the past. In addition to the (correct) entry in .gitignore, you also need to remove this file from git:

$ git rm --cached Yarn
Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • Ok I run the command "git rm --cached -r Yarn" and it runs without any errors. But how do I apply the changes to github? Gthub Desktop can't detect any changes so I can't commit anything.. – SteinTheRuler Dec 15 '18 at 06:24