{"meta":{"title":"Git LFS 的 REST API 端点","intro":"使用 REST API 为存储库启用或禁用 Git 大型文件存储 （LFS）。","product":"REST API","breadcrumbs":[{"href":"/zh/enterprise-cloud@latest/rest","title":"REST API"},{"href":"/zh/enterprise-cloud@latest/rest/repos","title":"存储库"},{"href":"/zh/enterprise-cloud@latest/rest/repos/lfs","title":"Git LFS"}],"documentType":"article"},"body":"# Git LFS 的 REST API 端点\n\n使用 REST API 为存储库启用或禁用 Git 大型文件存储 （LFS）。\n\n## 关于 Git LFS\n\n可用于 Git LFS 在 Git 存储库中存储大型文件。 使用 REST API 可以为单个存储库启用或禁用该功能。 有关 Git LFS 的详细信息，请参阅 [关于 Git 大文件存储系统](/zh/enterprise-cloud@latest/repositories/working-with-files/managing-large-files/about-git-large-file-storage)。\n\n对存储库具有管理员权限的人员可以使用这些终结点。\n\n使用 Git LFS 需计费。 有关详细信息，请参阅“[Git 大型文件存储计费](/zh/enterprise-cloud@latest/billing/concepts/product-billing/git-lfs)”。\n\n如果要在属于组织的存储库中使用这些终结点，首先必须作为管理员拥有存储库的访问权限（这可以由组织所有者继承），同时你的角色还必须具备访问组织计费的权限。\n\n* 如果存储库在 GitHub Team 上归某个组织所有，您必须是该组织的所有者或账单管理员。 有关详细信息，请参阅“[组织中的角色](/zh/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#organization-owners)”。\n* 如果仓库归某个组织所有，且该组织位于 GitHub Enterprise Cloud 上并且不归企业帐户所有，则您必须是组织所有者或计费经理。 有关详细信息，请参阅“[组织中的角色](/zh/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#organization-owners)”。\n* 如果存储库由企业帐户拥有的组织拥有，则你必须是企业所有者或计费经理。 有关详细信息，请参阅“[企业中角色的能力](/zh/enterprise-cloud@latest/admin/managing-accounts-and-repositories/managing-roles-in-your-enterprise/abilities-of-roles#enterprise-owners)”。\n\n> \\[!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## Enable Git LFS for a repository\n\n```\nPUT /repos/{owner}/{repo}/lfs\n```\n\nEnables Git LFS for a repository.\nOAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **202** - Accepted\n\n* **403** - We will return a 403 with one of the following messages:\n\nGit LFS support not enabled because Git LFS is globally disabled.\nGit LFS support not enabled because Git LFS is disabled for the root repository in the network.\nGit LFS support not enabled because Git LFS is disabled for .\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/repos/OWNER/REPO/lfs\n```\n\n**Response schema (Status: 202):**\n\nobject\n\n## Disable Git LFS for a repository\n\n```\nDELETE /repos/{owner}/{repo}/lfs\n```\n\nDisables Git LFS for a repository.\nOAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/repos/OWNER/REPO/lfs\n```\n\n**Response schema (Status: 204):**"}