In Visual Studio 2019, I'm trying to connect to our private GitHub Package Registry but keep getting unauhorized error.
Here's what I've done:
- Created a Personal Access Token (PAT) on GitHub with
Write
access to packages. - I then created a
nuget.config
file with following code and placed it inc:\Users\My_User_Name\AppData\Roaming\NuGet\
folder. - I also tried placing this
nuget.config
file in the project root
I still get unauthorized error when I try to connect to our GitHub Package Registry. Any idea what the problem is?
Here's the nuget.config
file contents:
<?xml version="1.0" encoding="utf-8"?><configuration><packageSources><clear /><add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /><add key="Our Corporate GitHub Packages" value="https://nuget.pkg.github.com/OUR_CORPORATE_ACCOUNT_ON_GITHUB/index.json" /><add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" /></packageSources><packageSourceCredentials><github><add key="Username" value="MY_GITHUB_USERNAME" /><add key="ClearTextPassword" value="MY_GITHUB_PERSONAL_ACCESS_TOKEN" /></github></packageSourceCredentials></configuration>