migrate Azure Devops artifacts to GitHub packages

614 Views Asked by At

Is there any simple way to migrate Azure Devops artifacts to GitHub packages? We have few artifacts which need to be migrated. Are there any tools available to do this?

2

There are 2 best solutions below

1
On

Follow the below steps to perform the migration operation.

dotnet tool install gpr -g
gpr push MyFakePackage.1.0.0.50.nupkg --repository https://github.com/MyRepo/my-repo-name

These two are the simple two lines of syntaxes to follow for migration.

0
On

I expanded upon @TadepalliSairam's solution a little bit here: https://josh-ops.com/posts/github-packages-migrate-nuget-packages-to-github-packages/. This is a post detailing a script that migrates .nupkg files to GitHub Packages.

Basically, you have to use gpr since it rewrites the <repository url="..." /> element in the .nuspec file in the .nupkg before pushing.

dotnet nuget push isn't capable of doing this and you will receive a 400 error right now:

dotnet nuget push \
  -s github \
  -k ghp_pat \
  NUnit3.DotNetNew.Template_1.7.1.nupkg

Pushing NUnit3.DotNetNew.Template_1.7.1.nupkg to 'https://nuget.pkg.github.com/joshjohanning-org-packages-migrated'...
  PUT https://nuget.pkg.github.com/joshjohanning-org-packages-migrated/
warn : Source owner 'joshjohanning-org-packages-migrated' does not match repo owner 'joshjohanning-org-packages' in repository element.
  BadRequest https://nuget.pkg.github.com/joshjohanning-org-packages-migrated/ 180ms
error: Response status code does not indicate success: 400 (Bad Request).