I have a .NET solution with about 10 projects of various things, MVC, libs and console app. We're in the process of using it with Git for the first time - BitBucket and SourceTree. Works fine on my local machine but when I do a clone, to test whether it's working properly I get loads of Nuget error, missing references and updating packages gets errors about the package already existing. It's a mess. My "solution" was to delete the whole packages folder and reinstall which works, sort of, but isn't a proper solution. So my question is as someone new to Git, not brilliant with Nuget, is where is it likely I'm going wrong in the commit process.
I suspect that I'm not excluding files properly - the project on Bitbucket is huge at 1GB. I thought the
This is the relevant section that I currently have in my
# NuGet Packages *.nupkg # The packages folder can be ignored because of Package Restore **/packages/* # except build/, which is used as an MSBuild target. !**/packages/build/ # Uncomment if necessary however generally it will be regenerated when needed #!**/packages/repositories.config
(I believe this
.gitignore was generated by Visual Studio.)
The important part is to ignore the
packages folder, but commit the
packages.config file for each project. Then you can use the
Restore Nuget packages menu option in Visual Studio to install packages as needed.
If you have accidentally committed the
packages folder, then to clean up your current repo you can do:
git rm --cached packages/* git commit -m "Remove Nuget packages from repo"
Then as long as you've added the
packages folder to the
.gitignore file, you should be good to go.