3

I have seen the same answers over and over and they don't work.

I've added the folders to my .gitignore file ... I can't seem to locate the folders in my GitHub repo so uncertain if they were ever added ...

I've tried the following but it doesn't work and undoes everything that was already added to my repo:

git rm -r --cached .

I've tried the following and it tells me it's not a file:

git rm -r --cached FOLDERNAME
git rm -r --cached FOLDERNAME\
git rm -r --cached "Full Path To Folder"

I do not want to delete them completely, so cleaning it is out of the question.

What can I do to fix this?

ProsperousHeart
  • 188
  • 1
  • 14
  • 2
    Can you share your `.gitignore` file? – Mudits Mar 13 '19 at 05:12
  • I think you should run these commands on root folder. – Sagar Mar 13 '19 at 05:14
  • Git doesn't store folders. Git only stores files (inside commits). Extract a commit that has a file named `a/b/c/d/e` and if `d` doesn't exist inside `c`, or `c` doesn't exist inside `b`, or `b` doesn't exist inside `a`, or `a` doesn't exist—or any combination—Git will *make* all the ones needed in order to extract the file named `a/b/c/d/e`. But don't look for `a/b/c/d` in Git: it's just not there. Only `a/b/c/d/e` is actually *in* Git, as part one or more commits. – torek Mar 13 '19 at 06:23
  • The `git status` command will *summarize* many (or even one) untracked file *within* `a`, or within `a/b/c/d`, depending on what else is inside Git, by just listing `a/` or `a/b/c/d/` or something in between. To make `git status` stop summarizing like this, use `git status -uall` to make it show each file one at a time. – torek Mar 13 '19 at 06:25
  • @torek git definitely stores folders. https://stackoverflow.com/a/343734/10474024 – ProsperousHeart Mar 14 '19 at 16:16
  • @KassandraKeeton: no, it doesn't. That answer is about `.gitignore` *ignoring* (the contents of) a folder. Ignore works based on files—folders list files, so you can en-masse ignore "all files in `d/` by listing `d/` in your `.gitignore`, but that doesn't mean Git was going to store `d/` itself. (Technically, in its internal storage format, Git stores *trees* with *sub-trees*. There is such a thing as the *empty tree*, but if you try to use it to store an empty folder, Git will *change* it to a special entry called a *gitlink*. See https://stackoverflow.com/q/9765453/1256452) – torek Mar 14 '19 at 17:22

2 Answers2

2

Really silly ... but you have to ensure that all of the slashes are forward. If in Windows, the backslash is not seen.

Good example:

TrainUp/
pandas/Data Camp/
Python/Recipes/.ipynb_checkpoints
Python/Basics/.ipynb_checkpoints

Bad example:

TrainUp\
pandas\Data Camp\
Python/Recipes/.ipynb_checkpoints
Python/Basics/.ipynb_checkpoints
ProsperousHeart
  • 188
  • 1
  • 14
0

Make sure:

  • the .gitignore is not inside the subfolder you are trying to ignore, but at least one level up (in the parent folder of the folder to be ignored)
  • the case (lower/upercase) is the same

Check the result of that .gitignore with:

git check-ignore -v -- foldername/afile
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250