skip to content

GitHub Packages

GitHub's registry family behind one identity system: ghcr.io for container images plus npm, Maven, NuGet and RubyGems endpoints, with visibility inherited from or overridden per repository. Most interview questions here are really auth questions — which token, which scopes, and how CI authenticates.

on this pageshow

explore

questions

11

In GitHub Packages, what visibility can a package have, and what changes once you make a container image public?

level: juniorimportance: must knowfreq 42%

answer

  1. three visibility levels
  2. the default at first publish
  3. a one-way door
  4. who can pull without logging in

basics

~10 s

A GitHub Packages package is private, internal or public, and an account-scoped package starts private. Making it public cannot be undone, and a public container image can then be pulled anonymously by anyone.

solid answer

~40 s

A package in GitHub Packages is **private**, **internal** or **public**. A package published to a granular registry such as the Container registry starts **private**, and a package admin changes it under *Change visibility* in the package settings. Internal packages are visible to every member of the organization, or of the enterprise when the organization belongs to one. The crucial rule is that **once a package is public it cannot be made private again**. For the Container registry, public also means **anonymous pulls**: anyone can pull the image without authenticating, whereas most other registries still require a token even for public packages. Public packages are free, and a public version that passes 5,000 downloads can no longer be deleted by its owner, so going public is a decision to think about before you click.

go deeper

for a junior

Remember the three levels, that new packages start private, and that public is permanent for that package.

for a middle

Explain why public container images pull anonymously while other registries still need a token, and where internal fits between private and public.

for a senior

Treat a visibility change as a release decision: check layer contents, the deletion limits on public versions and who will start depending on the package.

for a principal

Decide when internal visibility serves cross-team reuse better than public distribution, and how the organization's package-creation policy should constrain members.

## The three visibility levels In GitHub Packages, **visibility** decides who can see and install a package before any individual role is considered. For registries with granular permissions — Container, npm, NuGet and RubyGems — visibility is a setting of the package itself, and anyone with the package's **Admin** role can change it. Maven and Gradle packages are repository-scoped and take their permissions and visibility from the repository. | Visibility | Who can see it | |---|---| | **Private** | Only people, teams and repositories granted a role on the package | | **Internal** | Every member of the organization; every enterprise member if the organization belongs to an enterprise | | **Public** | Everyone on GitHub | When you first publish a package to a granular registry, its visibility is **private** and only you can see it until you grant access or change the setting. An organization can also restrict which visibilities members may create: under the organization's *Package Creation* setting an owner enables public, private or internal packages for members. A related limit: when an organization package is private or internal, its admin can grant roles only to members and teams of that organization. ## The one-way door The package settings place *Change visibility* in the **Danger Zone**, and the documentation warns plainly: **once you make a package public, you cannot make it private again.** There is no switch back in the settings. The practical consequences: 1. Anything in the published versions — a base image with internal tooling, a debug build, a configuration file — is readable by anyone from that moment, and copies may already exist outside your control. 2. Projects outside your organization may start depending on the package, which makes later deletion harmful to them. 3. Deleting a public package or version becomes restricted once downloads accumulate: a public version with more than 5,000 downloads cannot be deleted by its owner, and a whole public package cannot be deleted if any version passed that mark. GitHub Support is the route then. Treat the change as a release decision, reviewed like one, rather than a convenience toggle. ## What "public" means for container images Pull access is where the Container registry differs from the rest. In most GitHub Packages registries you must authenticate with a personal access token or `GITHUB_TOKEN` to pull a package, **even when it is public**. In the Container registry, public images allow **anonymous access** and can be pulled without signing in. That is why making an image public is the usual way to let anyone run it, and also why a mistakenly public image is immediately exposed to the whole internet. Public visibility also affects permissions for automation. A public package can be downloaded by a workflow in any repository; an internal one by workflows in repositories owned by the enterprise; a private one only by workflows in repositories that have been given read on the package. ## Visibility and linked repositories Linking a granular package to a repository can make it inherit the repository's **access permissions**, and the access-control guide says that inheritance does not include visibility. The guide on publishing from workflows, by contrast, describes a package created by a workflow with `GITHUB_TOKEN` as following the visibility and permissions model of the workflow's repository. The safe habit is to read the visibility on the package page after the first publish rather than infer it from the repository. ## Cost and housekeeping angles - Public packages are **free** to store and transfer; private ones count against the owner's plan allowance. - Public container images are convenient for open-source distribution, but their versions accumulate downloads quickly, which closes the deletion window. - If a team needs a package shared widely inside a company but not on the internet, **internal** visibility is the intended level, not public. ## Answers that lose points - "We can flip it back to private if it turns out to be a mistake." - "A public npm package on GitHub Packages installs without any token." - "A freshly pushed image is public until someone locks it down." - "Internal and private are the same thing."

  • In GitHub Packages, a teammate made an organization's container image public by mistake. What can you actually do?
    You cannot set it back to private. Delete the exposed versions or the whole package while the download counts still allow it — a public version above 5,000 downloads cannot be deleted by the owner — and republish under a fresh private package if needed. Treat anything in those layers, such as embedded credentials, as already leaked.
  • In GitHub Packages, how do internal packages differ from private ones?
    An internal package is visible to every member of the organization, or every enterprise member when the organization belongs to an enterprise, without individual grants. A private package is visible only to the people, teams and repositories given a role on it.

  • A public package can be switched back to private later from its settings.
  • Every public GitHub Packages registry allows anonymous installs, not just containers.
  • A freshly pushed container image starts out public.
  • Internal visibility means only the package's admins can see it.
  • A public version can always be deleted, whatever its download count.
open as a page

In GitHub Packages, what is the Container registry at ghcr.io, and how do you log the Docker client in to push an image there?

level: juniorimportance: must knowfreq 48%

basics

~20 s

ghcr.io is the GitHub Packages registry for Docker and OCI images, scoped to a user or organisation. Log in with docker login ghcr.io using a classic personal access token with write:packages, or GITHUB_TOKEN with packages: write inside a workflow.

open as a page

In GitHub Packages, how do granular package permissions differ from repository-scoped ones, and when does a package inherit its linked repository's access?

level: middleimportance: must knowfreq 34%

basics

~20 s

Container, npm, NuGet and RubyGems packages belong to an account and can carry their own Read, Write and Admin roles; Maven and Gradle packages always follow their repository. A linked package inherits repository access until you remove that inheritance.

open as a page

In GitHub Packages, how does Maven find the token for maven.pkg.github.com, and why must the repository id match a settings.xml server id?

level: middleimportance: should knowfreq 24%

basics

~10 s

Maven sends credentials only for a repository whose id matches a server id in ~/.m2/settings.xml; that server holds the GitHub username and a classic token, and the repository URL is https://maven.pkg.github.com/OWNER/REPOSITORY.

open as a page

In GitHub Packages, how does a project point npm at npm.pkg.github.com, and why must the package scope match the owning account?

level: middleimportance: should knowfreq 30%

basics

~10 s

GitHub Packages hosts only scoped npm packages, and the scope is the owning user or organisation, so .npmrc maps @acme to https://npm.pkg.github.com and a separate auth line supplies a classic token for that host.

open as a page

In GitHub Packages, why might private npm downloads start counting against data-transfer allowance after CI moves to self-hosted runners?

level: seniorimportance: should knowfreq 18%

basics

~10 s

GitHub Packages bills private storage and outbound transfer. Downloads are free when a workflow logs in with GITHUB_TOKEN; with a personal access token they are free on GitHub-hosted runners but billed on self-hosted ones.

open as a page

In GitHub Packages, one version of your public npm package is compromised; what can you delete, what can block you, and how long can you restore it?

level: seniorimportance: should knowfreq 22%

basics

~20 s

A package admin can delete that single version unless it is public with more than 5,000 downloads, which needs GitHub Support. A deleted version or package can be restored within 30 days if its namespace and version have not been reused.

open as a page

In GitHub Packages, what happens to a repository's linked container image and its Maven package when the repository is transferred to another organization?

level: seniorimportance: should knowfreq 14%

basics

~10 s

The container image stays in the original organization, its repository link is removed and inherited access is lost. The Maven package moves with the repository, and its billable usage moves to the new owner.

open as a page

In GitHub Packages, your Container registry holds three years of untagged image versions; where do they come from, and how do you prune them safely?

level: seniorimportance: should knowfreq 24%

basics

~20 s

Each pushed image digest becomes a version; when a tag moves to a newer push, the old version is left untagged. GitHub Packages documents no automatic cleanup, so a job lists versions and deletes untagged ones it has checked are unused.

open as a page

In GitHub Packages, a second private repository's workflow must install your organisation's private npm library and pull its image; how do you grant that without a personal token?

level: seniorimportance: should knowfreq 20%

basics

~10 s

On each package's settings, use Manage Actions access to add the consuming repository with the Read role; its workflow then authenticates with its own GITHUB_TOKEN. Maven and Gradle packages lack this, being repository-scoped.

open as a page