Skip to main content
If the backend rejects the update (for example, the branch moved past expectedHeadSha), repo.createCommit().send() throws a RefUpdateError containing the status, reason, and ref details.

Builder Methods

string
Attach bytes, async iterables, readable streams, or buffers.
string
Add UTF-8 text files.
string
Remove files or folders.
string
Finalize the commit and receive metadata about the new commit.

Options

string
required
Branch name that will receive the commit (for example main).
string
required
The commit message.
string
required
Provide name and email for the commit author.
string
Commit SHA that must match the remote tip; omit to fast-forward unconditionally.
string
Mirrors the base_branch metadata field. Point to an existing branch whose tip should seed targetBranch if it does not exist. When bootstrapping a new branch, omit expectedHeadSha so the service copies from baseBranch; if both fields are provided and the branch already exists, the expectedHeadSha guard still applies.
string
Store the branch under the refs/namespaces/ephemeral/... namespace. When enabled, the commit is kept out of the primary Git remotes (for example, GitHub) but remains available through storage APIs.
string
Use alongside baseBranch when the seed branch also lives in the ephemeral namespace. Requires baseBranch to be set.
string
Provide name and email. If omitted, the author identity is reused.
string
Abort an in-flight upload with AbortController.
string
Deprecated. Fully qualified ref (for example refs/heads/main). Prefer targetBranch.
object[]
Ordered per-ref policy rules ({ pattern, ops? }) embedded in the per-call JWT. First match wins. Python: ref_policies. Go: RefPolicies with type storage.RefPolicyList. See the Branch Protection guide.

Response

string
The SHA of the created commit
string
The SHA of the commit’s tree object
string
The branch that received the commit
number
Size of the uploaded pack in bytes
number
Number of blobs in the commit
object
Contains branch, oldSha/old_sha, and newSha/new_sha

Streaming Large Files

Use streams or async generators to upload large files without loading them into memory:
The SDK automatically chunks files to 4 MiB segments, so you can stream large assets (videos, archives, datasets) without buffering them entirely in memory.

Response

The send() method returns the following: