POST
/repos/{owner}/{repo}/git/blobsCreate a Git blob
Creates a Git blob in a specified repository. Supply the blob content and optionally choose encoding; the returned object provides the new blob's URL and SHA identifier.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
ownerstringrequired
The account owner of the repository; the name is not case sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case sensitive.
The content and encoding for the Git blob to create.
contentstringrequired
The new blob's content.
encodingstringoptional
The encoding used for `content`. Currently, `"utf-8"` and `"base64"` are supported.
201Returns the created blob's URL and SHA identifier.
urlstringrequired
shastringrequired
403Returned when the authenticated user is not permitted to create a blob in the repository.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the specified repository cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
409Returned when creating the blob conflicts with the repository state.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when the request fails validation or violates a repository rule.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional
Error handling
content is required, and encoding must be utf-8 or base64 when provided; it defaults to utf-8. A 403 indicates that the request is not permitted, a 404 indicates that the repository cannot be found, and a 409 indicates a conflict. A 422 is returned when validation fails or a repository rule violation is detected.