1

I am facing a rather strange issue with my git working folders. Here's the summary:

  • I previously had a local git repo with a .gitignore file that ignored certain files/folders.

  • I deleted the repo (.git folder) and also the .gitignore file

  • Then I initialized a new one with git init in the same folder. Now when I do a "git add .", the previous ignore pattern is retained for some reason.

  • Even stranger,this happens with any new project following the same folder structure no matter where I place the project on my computer.

  • I tried deleting and recreating the files multiple times. I even created a new .gitignore file with a different pattern. It does not seem to have an effect except when it is set to ignore everything (with just * in the file)

My guess is that the .gitignore pattern I deleted is somewhere saved that I dont know the location of. If anyone has faced a similar issue or know what I could be missing, I'd love to know. I am still new to git. Sorry if this is something very obvious that I have missed out on.

UPDATE: I still have not found the reason for this behaviour but managed to reset everything by doing 'git add --force .' in the directory and then deleting the repo. Now I initialized a new repo that works as expected.

Pooja Hegde
  • 31
  • 1
  • 8
  • What is the output of `git config --global core.excludesfile`? – dan1st Mar 16 '20 at 13:38
  • It turns up empty: poh@nb-poh MINGW64 /c/CM_Projects/Internal/HPC_main (master) $ git config --global core.excludesfile poh@nb-poh MINGW64 /c/CM_Projects/Internal/HPC_main (master) $ – Pooja Hegde Mar 16 '20 at 13:40
  • How are you deleting the older folder? – qaisjp Mar 16 '20 at 13:44
  • @qaisjp I am just deleting it with right-click -> delete. What I dont understand is how the ignore pattern turns up on a completely unrelated new folder structure. – Pooja Hegde Mar 16 '20 at 13:47
  • Make sure you have `cd`'d to the correct folder in your terminal after you delete it. If you don't, your terminal will still be in the old folder (in the trash) – qaisjp Mar 16 '20 at 13:47
  • That's good to know. Although I opened a new terminal altogether in the new location – Pooja Hegde Mar 16 '20 at 13:53

0 Answers0