.gitignore NuGet exclude packages/ include packages/repositories.config

Dipesh picture Dipesh · May 28, 2012 · Viewed 40.2k times · Source

I'm trying to create a .gitignore for a Visual Studio project that uses NuGet. It currently contains:

\packages/*
!packages/repositories.config

This does not ignore anything in the folder. Everything gets staged on an add. I have also tried:

packages/
!packages/repositories.config

This ignores everything in the packages folder and does not include the packages/repositories.config.

What am I doing wrong?

Answer

manojlds picture manojlds · May 28, 2012
/packages/
!packages/repositories.config

You can also add a .gitignore in the packages folder:

*
!repositories.config
!.gitignore