Is there any simple way to migrate all our existing NuGet packages to GitHub Package Registry?

I’m looking to move all of our company’s NuGet packages to GPR; we’re migrating all our git repos into GitHub, so it makes sense to me to host all our artifacts in GitHub too.

However, I can’t currently see a way I can get all of the historical versions from our current, self-hosted (but otherwise standard) NuGet feed into the GitHub Package Registry. 

What I’d like to do ideally, on a repo-by-repo basis, is:

  1. Migrate the Git repository into GitHub
  2. Point something at our current NuGet feed (or run a script) which will get all the versions of the package corresponding to that repository, and then push them to GPR

After some research, I found that there’s a Powershell module which would help if we wanted to migrate to Azure Artifacts, but before I try hacking about with that code or writing something from scratch myself, I thought it was worth asking here!

Is there anything like this available, or has anyone else scripted this yet?

1 Like

Is there anything like this available, or has anyone else scripted this yet?

The trick will be to update the <repository url="..." /> element in the .nuspec file in your .nupkg. This is mandatory when publishing to GitHub Packages and tells the registry which repository to associate with your package.

I have a .NET Core tool that supports publishing NuGet packages to the GitHub Package registry (and a few other things). You can find it here:

There’s an issue open about automatically adding the repository url on push:

Feel free to comment or send a PR my way! :smile: