我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

About GitHub Packages

GitHub 包注册表 is a software package hosting service that allows you to host your software packages privately or publicly and use packages as dependencies in your projects.

GitHub 包注册表 is available with GitHub Free, GitHub Pro, GitHub Team, and GitHub Enterprise Cloud. GitHub 包注册表 is unavailable for per-repository plans, which are legacy billing plans. For more information, see "GitHub's products."

本文内容

About packages

A package is a self-contained and reusable piece of software that includes code and metadata, such as current version number, name, and the package's dependencies, that a developer bundles together in a common place for others to use. Packages simplify using and distributing solutions to common problems such as needing a common framework for developing a project, testing runners and linters to improve code quality, or introducing industry-standard machine learning tools to power your application.

关于 GitHub 包注册表

GitHub 包注册表 is a package hosting service, fully integrated with GitHub. GitHub 包注册表 combines your source code and packages in one place to provide integrated permissions management and billing, so you can centralize your software development on GitHub.

You can publish packages in a public repository (public packages) to share with all of GitHub, or in a private repository (private packages) to share with collaborators or an organization. You can use GitHub roles and teams to limit who can install or publish each package, as packages inherit the permissions of the repository. Anyone with read permissions for a repository can install a package as a dependency in a project, and anyone with write permissions can publish a new package version.

You can host multiple packages in one repository and see more information about each package by viewing the package's README, download statistics, version history, and more.

You can integrate GitHub 包注册表 with GitHub APIs, GitHub 操作, and webhooks to create an end-to-end DevOps workflow that includes your code, CI, and deployment solutions.

关于 GitHub 包注册表 的计费

GitHub 包注册表 usage is free for public packages. For private packages, each GitHub account receives a certain amount of free storage and data transfer, depending on the product used with the account. By default, your account will have a spending limit of $0, which prevents additional usage of storage or data transfer after you reach the included amounts. If you increase your spending limit above the default of $0, you will be billed for any additional storage or data transfer, also called overages, up to your spending limit. For more information, see "About billing for GitHub 包注册表."

支持的客户端和格式

GitHub 包注册表 uses the native package tooling commands you're already familiar with to publish and install package versions.

GitHub 包注册表 目前支持以下客户端和格式。

包客户端 语言 包格式 描述
npm JavaScript package.json Node package manager
gem Ruby Gemfile RubyGems package manager
mvn Java pom.xml Apache Maven project management and comprehension tool
gradle Java build.gradlebuild.gradle.kts Gradle build automation tool for Java
docker N/A Dockerfile Docker container management platform
nuget .NET nupkg NuGet package management for .NET

For more information about configuring your package client for use with GitHub 包注册表, see "Using GitHub 包注册表 with your project's ecosystem."

About tokens

You need an access token to publish, install, and delete packages in GitHub 包注册表. You can use a personal access token to authenticate with your username directly to GitHub 包注册表 or the GitHub API. You can use a GITHUB_TOKEN to authenticate using a GitHub 操作 workflow.

When you create a personal access token, you can assign the token different scopes depending on your needs. For more information, see "Creating a personal access token for the command line" and "Available scopes" in GitHub 开发者文档.

To install, publish, or delete a package, you must use a token with the appropriate scope, and your user account must have appropriate permissions for that repository. For example, to download and install packages from a repository, your token must have the read:packages scope, and your user account must have read permissions for the repository. If the repository is private, your token must also have the repo scope.

Scope Description Repository permissions
read:packages Download and install packages from GitHub 包注册表 读取
write:packages Upload and publish packages to GitHub 包注册表 写入
delete:packages Delete packages from GitHub 包注册表 管理员
repo Install, upload, and delete packages in private repositories (along with read:packages, write:packages, or delete:packages) read, write, or admin

When you create a GitHub 操作 workflow, you can use the GITHUB_TOKEN to publish and install packages in GitHub 包注册表 without needing to store and manage a personal access token. For more information, see "Using GitHub 包注册表 with GitHub 操作."

Managing packages with the GitHub API

You can use the GraphQL API to query and delete packages, using the same token you use to authenticate to GitHub 包注册表. For more information, see "Forming calls with GraphQL" in GitHub 开发者文档.

You can configure webhooks to subscribe to package-related events, such as when a package is published or updated. For more information, see "RegistryPackageEvent" in GitHub 开发者文档.

联系支持

If you have feedback or feature requests for GitHub 包注册表, use the feedback form for GitHub 包注册表.

Contact GitHub 支持 about GitHub 包注册表 using our contact form if:

  • You experience anything that contradicts the documentation
  • You encounter vague or unclear errors
  • Your published package contains sensitive data, such as GDPR violations, API Keys, or personally identifying information

问问别人

找不到要找的内容?

联系我们