2

I'm trying to add an exception to my .gitignore file to include my team's custom npm packages in our repository, so we can work with vendors without giving them the password to our private account.

I'm trying this:

node_modules/
!node_modules/@our-team

But .gitignore does not pick it up and start including that folder. Any ideas?

I'm on Windows but need to support Mac as well.

Arpit Solanki
  • 9,567
  • 3
  • 41
  • 57
EHorodyski
  • 774
  • 1
  • 8
  • 30
  • 1
    I know it looks at first like the other question is about something else—but this is the problem: once Git is able to exclude the entire directory `node_modules/`, Git never looks *inside* it to see `node_modules/@our-team` and hence never finds the override. If you ignore `node_modules/*` instead of `node_modules`, Git will have to look inside `node_modules` to find `*` to ignore. – torek Aug 29 '17 at 14:44
  • Thank you, that's the actual source of the issue here! – EHorodyski Aug 29 '17 at 14:46

2 Answers2

2

You can use \ to escape the @ symbol

!node_modules/\@our-team

Find more info on gitignore files.

Arpit Solanki
  • 9,567
  • 3
  • 41
  • 57
0

You can put it in quotes !"node_modules/@our-team"

Source: just tested with git check-ignore

Matteo Ragni
  • 2,837
  • 1
  • 20
  • 34