Note: This package type may not be available for your instance, because site administrators can enable or disable each supported package type. For more information, see "Configuring package ecosystem support for your enterprise."
Authenticating to GitHub Packages
You need an access token to publish, install, and delete private, internal, and public packages.
You can use a personal access token to authenticate to GitHub Packages or the GitHub Enterprise Server API. When you create a personal access token, you can assign the token different scopes depending on your needs. For more information about packages-related scopes for a personal access token, see "About permissions for GitHub Packages."
To authenticate to a GitHub Packages registry within a GitHub Actions workflow, you can use:
GITHUB_TOKENto publish packages associated with the workflow repository.- a personal access token with at least
read:packagesscope to install packages associated with other private repositories (whichGITHUB_TOKENcan't access).
Authenticating in a GitHub Actions workflow
Use the following command to authenticate to GitHub Packages in a GitHub Actions workflow using the GITHUB_TOKEN instead of hardcoding a personal access token in a nuget.config file in the repository:
dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.HOSTNAME/NAMESPACE/index.json"
Replace NAMESPACE with the name of the personal account or organization that owns the repository where your packages are hosted.
For more information about GITHUB_TOKEN used in GitHub Actions workflows, see "Automatic token authentication."
Authenticating with a personal access token
You need an access token to publish, install, and delete private, internal, and public packages.
You can use a personal access token to authenticate to GitHub Packages or the GitHub Enterprise Server API. When you create a personal access token, you can assign the token different scopes depending on your needs. For more information about packages-related scopes for a personal access token, see "About permissions for GitHub Packages."
To authenticate to a GitHub Packages registry within a GitHub Actions workflow, you can use:
GITHUB_TOKENto publish packages associated with the workflow repository.- a personal access token with at least
read:packagesscope to install packages associated with other private repositories (whichGITHUB_TOKENcan't access).
You must use a personal access token with the appropriate scopes to publish and install packages in GitHub Packages. For more information, see "Introduction to GitHub Packages."
To authenticate to GitHub Packages with the dotnet command-line interface (CLI), create a nuget.config file in your project directory specifying GitHub Packages as a source under packageSources for the dotnet CLI client.
You must replace:
USERNAMEwith the name of your personal account on GitHub.TOKENwith your personal access token.NAMESPACEwith the name of the personal account or organization that owns the repository where your packages are hosted.HOSTNAMEwith the host name for your GitHub Enterprise Server instance.
If your instance has subdomain isolation enabled:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="github" value="https://nuget.HOSTNAME/NAMESPACE/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="USERNAME" />
<add key="ClearTextPassword" value="TOKEN" />
</github>
</packageSourceCredentials>
</configuration>
If your instance has subdomain isolation disabled:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="github" value="https://HOSTNAME/_registry/nuget/NAMESPACE/index.json" />
</