Skip to main content

We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the new Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks REST API pages.

Git LFS

Enable Git LFS for a repository

put /repos/{owner}/{repo}/lfs

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

ownerstringpath
repostringpath

Code samples

Example

Shell
curl \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/OWNER/REPO/lfs
JavaScript @octokit/core.js
await octokit.request('PUT /repos/{owner}/{repo}/lfs', { owner: 'OWNER', repo: 'REPO' })
GitHub CLI gh api
gh api \ --method PUT \ -H "Accept: application/vnd.github.v3+json" \ /repos/OWNER/REPO/lfs

Accepted

Status: 202

Status codes

HTTP Status CodeDescription
202

Accepted

403

We will return a 403 with one of the following messages:

  • Git LFS support not enabled because Git LFS is globally disabled.
  • Git LFS support not enabled because Git LFS is disabled for the root repository in the network.
  • Git LFS support not enabled because Git LFS is disabled for .

Disable Git LFS for a repository

delete /repos/{owner}/{repo}/lfs

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

ownerstringpath
repostringpath

Code samples

Example

Shell
curl \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/OWNER/REPO/lfs
JavaScript @octokit/core.js
await octokit.request('DELETE /repos/{owner}/{repo}/lfs', { owner: 'OWNER', repo: 'REPO' })
GitHub CLI gh api
gh api \ --method DELETE \ -H "Accept: application/vnd.github.v3+json" \ /repos/OWNER/REPO/lfs

Response

Status: 204

Status codes

HTTP Status CodeDescription
204

No Content