0

I am using eclipse java as an editor and would like to use the .gitignore to exclude the build folder for the project. This is what I have currently written in my .gitignore. The syntax seems to be right; I used the git documentation but I may have interpreted it wrong.

#ignoring the files within the build folder
/build/
build/**

I'm using a brand new repo so I shouldn't have any problems with already logged files in the repo.

I am trying to get git to ignore the build folder in the project file using a .gitignore. The ignore file didn't work. What could be a solution?

Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
LukeDev
  • 509
  • 4
  • 19
  • So what is the problem you're having and trying to solve? – nitind Jan 20 '18 at 17:38
  • 1
    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) – toniedzwiedz Jan 20 '18 at 19:12
  • This isn't about removing an already tracked file, this is about an initial git ignore – LukeDev Jan 20 '18 at 19:16
  • If the file `.gitignore` is located in the folder that contains the subfolder `build`, both (`/build/` and `build/**`) should work. If `build` is not empty, you can also right-click the `build` folder and choose _Team > Ignore_ to create the `.gitignore` file (if it does not yet exist) and add the line `/build/`. – howlger Jan 20 '18 at 23:02
  • Right click where? – LukeDev Jan 22 '18 at 23:11

1 Answers1

-1

The way the .gitignore is written, this file needs to be in the same subfolder as the build folder, the file being ignored.

LukeDev
  • 509
  • 4
  • 19