NuGet Restore with private and public feed

I use github packages to publish c#/.net core assemblies to a private nuget feed. This happens with a github action in the build pipeline. 

In a second repository, I use one of this private nuget packages. The build and restore of my project works fine, as long as I run the commands on my local machine. 

The Github action fails always, when i try to restore my project.

First of all, i add my private feed to the nuget config, and call the restore command. I tried booth, the dotnet restore and the nuget restore, but I always get the same error. It was not possible to find my package.

nuget sources add -name "private-packages" -source[username]/index.json -StorePasswordInClearText -username [username] -password ${{ secrets.GITHUB_TOKEN }}
nuget restore

nuget sources add -name "private-packages" -source[username]/index.json -StorePasswordInClearText -username [username] -password ${{ secrets.GITHUB_TOKEN }}
dotnet restore

NU1101: Unable to find package The.Name.Of.The.Package. No packages exist with this id in source(s): private-packages,

I didn’t found the reason.

  • The restore from the same feed works on my local machine.

  • The push of the NuGet package works via Github Action in my CI Pipeline

  • I even tried the token I use on my local machine insted of secrets.GITHUB_TOKEN for auth.

Would be great, if someone has an idea for me.


Unfortunately, you can’t use the GITHUB_TOKEN to access the NuGet packages in another repo. You must instead configure and use a personal access token (PAT) in every other repository. I hope this gets fixed one day.

1 Like

Thank you for the reply. I already tried to acess the nuget feed with a PAT, that didn’t work… I used the same PAT like on my developer machine, to access the nuget feed.  

1 Like

Can you enable step debug logging and then share the debug logs here? 

I tested in my side, I run my job on hosted windows runner, and use PAT could restore a package from private repo. 

1 Like

@jsiedentop Can you check if the username and the package name have a typo? Also, please make sure the PAT you used is passing to the nuget sources add  command correctly.[**username**]/index.json

NU1101: Unable to find package **The.Name.Of.The.Package**. No packages exist with this id in source(s): private-packages,

If you cannot find the root cause of your issue , could you please share your workflow yml content here?  

Here is my example which works fine in windows runner with PAT: 

name: CI

on: [push]


    runs-on: windows-latest

    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
        dotnet-version: 2.2.108

    - name: Install NuGet client
      uses: warrenbuckley/Setup-Nuget@v1
    - name: restore package
      run: |
        nuget sources add -name "private-packages" -Source -StorePasswordInClearText -Username yanjingzhu -Password ${env:Password}
        dotnet restore ConsoleApp1
      working-directory: ConsoleApp1
        Password: ${{ secrets.PackagePAT }}
1 Like

I tested the workflow and I can add that the comand 

nuget sources add

 doesn’t work on linux, on my part.


What’s the error message you got? 

On Linux machine, you need to use $variable_name (bash syntax) instead of  ${env:variable_name } (powershell syntax). Please refer to this document: 

nuget sources add -name "private-packages" -Source -StorePasswordInClearText -Username yanjingzhu -Password **$Password**
1 Like

I am in exactly the same place and would appreciate any help.
I have tried the nuget.config approach as well as the credential provider.

I end up with the same error where it says package with id was not found. I have tried the above suggestions but to no avail.

I have three private repositories that publish nuget packages to GitHub Package registry and a fourth private repository that depends on the above packages. I am using PAT with the right scopes but it doesn’t work.

Using multi-stage docker builds.
Unable to build locally and end up with the same error.

I’ll appreciate some help.



Rather than creating a nuget.config file on the fly, you could use my gpr tool from

You can use it to publish a NuGet package like this:

dotnet tool install gpr -g
gpr push path/to/*.nupkg -k <PAT>

Your PAT must have the repo, read:packages and write:packages scopes.

I hope that helps!