Bilal Fazlani
Bilal Fazlani

Reputation: 6967

Should github repo also have nuget packages folder?

What are the advantages / disadvantages OR the standard practice of including packages in your github repo?

Upvotes: 6

Views: 4214

Answers (2)

Jon Hanna
Jon Hanna

Reputation: 113302

It has disadvantages similar to including produced code like the binaries the project itself produces; anyone updating the packages will now have a bunch of commits to do, which will potentially conflict with those done by someone else who updated the packages, and it can get very messy for zero gain.

I normally have the following in my .gitignore for .NET projects:

packages/**/*
!packages/repositories.config

That is, it ignores all of the contents of any folder called "packages" except for the repositories.config, which gets included in the repo, so any cloned repository has all it needs to restore the needed packages from nuget.

Upvotes: 8

Evk
Evk

Reputation: 101493

I think that the best practice is to omit nuget packages. There is central source where you always can get package of given version (nuget itself), so there is not much sense to bloat your git repostory with them. Every developer can use Automatic Package Restore feature (see https://docs.nuget.org/consume/package-restore), to automatically download any missing nuget packages on build. Article above from nuget docs also shows you how to correctly setup things for this.

Upvotes: 2

Related Questions