> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CommitGitCodeStoreProjectUpload

# Package: gitCodestore

# Namespace: GitCodeStoreManagedProjectManagement

# Method link: https://dev.wix.com/docs/api-reference/account-level/git-codestore/commit-git-code-store-project-upload.md

## Introduction

Commits and pushes a previously uploaded ZIP's contents to an existing branch.

Replaces the complete tracked file tree. Does not publish or deploy the application.
Files omitted from the ZIP are deleted. Creates one child commit and preserves history; never resets the branch history.
Defaults to main. An empty ZIP intentionally removes all files. An unchanged tree creates no commit.
Unless force is true, a stale expected head fails even for unchanged input.
Force replaces the latest checked-out tree and preserves history; concurrent writes can still conflict.
Accepts at most 64 MiB compressed, 256 MiB expanded, and 10,000 ZIP entries.
Rejects unsafe paths, Git metadata, submodules, and symlinks outside the repository.
After a timeout, call [Generate Git Code Store Project Download Url](https://dev.wix.com/docs/api-reference/account-level/git-codestore/generate-git-code-store-project-download-url.md)
for the same branch with `revisionId` omitted.
Compare its revision and downloaded tree with your intended changes before retrying.
A changed head alone does not prove this request succeeded. Do not use force to recover from a timeout.
Requires an authenticated user with update access to the app or its companion site.

---

## REST API

### Schema

```
 Method: commitGitCodeStoreProjectUpload
 Description: Commits and pushes a previously uploaded ZIP's contents to an existing branch.  Replaces the complete tracked file tree. Does not publish or deploy the application. Files omitted from the ZIP are deleted. Creates one child commit and preserves history; never resets the branch history. Defaults to main. An empty ZIP intentionally removes all files. An unchanged tree creates no commit. Unless force is true, a stale expected head fails even for unchanged input. Force replaces the latest checked-out tree and preserves history; concurrent writes can still conflict. Accepts at most 64 MiB compressed, 256 MiB expanded, and 10,000 ZIP entries. Rejects unsafe paths, Git metadata, submodules, and symlinks outside the repository. After a timeout, call [Generate Git Code Store Project Download Url](https://dev.wix.com/docs/api-reference/account-level/git-codestore/generate-git-code-store-project-download-url.md) for the same branch with `revisionId` omitted. Compare its revision and downloaded tree with your intended changes before retrying. A changed head alone does not prove this request succeeded. Do not use force to recover from a timeout. Requires an authenticated user with update access to the app or its companion site.
 URL: https://www.wixapis.com/codestore/v2/git-code-store-projects/{managedProjectId}/commit-upload
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  uploadId, commit, commit.message, commit.author, commit.author.name, commit.author.email
 Method parameters: 
   param name: branchName | type: branchName | description: Existing branch. Defaults to main.  | validation: minLength 1, maxLength 250
   param name: commit | type: GitCodeStoreProjectCommitOptions | description: Git commit metadata supplied by the caller when creating a revision. | required: true 
        - name: message | type: string | description: Commit message. | required: true | validation: minLength 1, maxLength 2000
        - name: author | type: GitCodeStoreProjectCommitAuthor | description: Commit author. | required: true 
           - name: name | type: string | description: Author name. | required: true | validation: minLength 1, maxLength 100
           - name: email | type: string | description: Author email. | required: true | validation: format EMAIL
   param name: expectedHeadRevisionId | type: expectedHeadRevisionId | description: Full SHA from the download URL response. Required unless force is true; ignored when force is true. Prevents replacing code changed since the download. The handler requires exactly 40 hexadecimal characters when force is false; missing, empty, abbreviated, or non-hexadecimal values are rejected before reading the upload.  | validation: maxLength 40
   param name: force | type: force | description: Replace the latest branch tree even if it changed since download. Defaults to false. Preserves history by creating a normal commit; concurrent writes can still cause a conflict.  
   param name: uploadId | type: uploadId | description: Identifier returned by GenerateGitCodeStoreProjectUploadUrl. The ZIP must have been uploaded within the last hour. | required: true | validation: format GUID
 Return type: CommitGitCodeStoreProjectUploadResponse
  - name: revision | type: Revision | description: New revision, or the existing revision when the file tree is unchanged.  
     - name: id | type: string | description: Revision identifier  | read-only: true | validation: maxLength 40
     - name: description | type: string | description: Revision description message  | read-only: true | validation: maxLength 2000
     - name: creationTime | type: string | description: Creation time  | read-only: true | validation: format date-time
     - name: author | type: Author | description: Author details  
        - name: name | type: string | description: Author name  | read-only: true | validation: maxLength 100
        - name: email | type: string | description: Author email  | read-only: true | validation: format EMAIL
  - name: branchName | type: string | description: Resolved branch name.  | validation: minLength 1, maxLength 250
  - name: changed | type: boolean | description: Whether a replacement commit was created.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REPOSITORY_ARCHIVE_TOO_LARGE | Description: The upload exceeds 64 MiB compressed, 256 MiB expanded, or 10,000 ZIP entries (including directories).
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_REPOSITORY_ARCHIVE | Description: The ZIP is corrupt or contains unsafe or unsupported entries. Also returned for a malformed project GUID, an invalid `expectedHeadRevisionId` when force is false, or missing or blank commit metadata.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: REPOSITORY_UPLOAD_NOT_FOUND | Description: Couldn't find the upload. It may belong to another project, be at least 1 hour old, or have changed while being read.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GIT_BRANCH_NOT_FOUND | Description: Couldn't find the target branch.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: GIT_HEAD_COMMIT_MISMATCH | Description: The branch head differs from `expectedHeadRevisionId`, including when the uploaded tree is unchanged.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: GIT_PUSH_CONFLICT | Description: The remote branch changed before the push completed. Download the current tree and reconcile before retrying.


```

### Examples

### Commit the uploaded replacement tree
After a successful signed PUT, commit using the uploadId and the revision.id from the download example. Use the same managed project, branch, and companion site. This replaces all tracked files, including deleting files omitted from the ZIP.

```curl
curl -X POST \
'https://www.wixapis.com/codestore/v2/git-code-store-projects/72357e9a-2094-40b3-8626-9354a5089b49/commit-upload' \
-H 'Authorization: <AUTH>' \
-H 'wix-site-id: 426f1a4c-cc7a-43b0-92d9-e267c56f8d27' \
-H 'Content-Type: application/json' \
-d '{
  "uploadId": "d9ef51cb-d776-4fc8-8d33-3ac139d2bb9a",
  "branchName": "main",
  "expectedHeadRevisionId": "c1531e925af90ed3d1cb105d46e8c7282aecd630",
  "commit": {
    "message": "Update the homepage",
    "author": {
      "name": "Jane Doe",
      "email": "jane.doe@example.com"
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.gitCodeStore.projects.commitGitCodeStoreProjectUpload(managedProjectId, uploadId, options)
 Description: Commits and pushes a previously uploaded ZIP's contents to an existing branch.  Replaces the complete tracked file tree. Does not publish or deploy the application. Files omitted from the ZIP are deleted. Creates one child commit and preserves history; never resets the branch history. Defaults to main. An empty ZIP intentionally removes all files. An unchanged tree creates no commit. Unless force is true, a stale expected head fails even for unchanged input. Force replaces the latest checked-out tree and preserves history; concurrent writes can still conflict. Accepts at most 64 MiB compressed, 256 MiB expanded, and 10,000 ZIP entries. Rejects unsafe paths, Git metadata, submodules, and symlinks outside the repository. After a timeout, call [Generate Git Code Store Project Download Url](https://dev.wix.com/docs/api-reference/account-level/git-codestore/generate-git-code-store-project-download-url.md) for the same branch with `revisionId` omitted. Compare its revision and downloaded tree with your intended changes before retrying. A changed head alone does not prove this request succeeded. Do not use force to recover from a timeout. Requires an authenticated user with update access to the app or its companion site.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  managedProjectId, uploadId, options.commit, options.commit.message, options.commit.author, options.commit.author.name, options.commit.author.email, options
 Method parameters: 
   param name: managedProjectId | type: string | description: GUID of the existing AppManagedProject to update. Must be the same project that issued `uploadId`. | required: true | validation: format GUID
   param name: options | type: CommitGitCodeStoreProjectUploadOptions  none | required: true 
        - name: branchName | type: string | description: Existing branch. Defaults to main.  | validation: minLength 1, maxLength 250
        - name: expectedHeadRevisionId | type: string | description: Full SHA from the download URL response. Required unless force is true; ignored when force is true. Prevents replacing code changed since the download. The handler requires exactly 40 hexadecimal characters when force is false; missing, empty, abbreviated, or non-hexadecimal values are rejected before reading the upload.  | validation: maxLength 40
        - name: commit | type: GitCodeStoreProjectCommitOptions | description: Message and author for the replacement commit. | required: true 
           - name: message | type: string | description: Commit message. | required: true | validation: minLength 1, maxLength 2000
           - name: author | type: GitCodeStoreProjectCommitAuthor | description: Commit author. | required: true 
              - name: name | type: string | description: Author name. | required: true | validation: minLength 1, maxLength 100
              - name: email | type: string | description: Author email. | required: true | validation: format EMAIL
        - name: force | type: boolean | description: Replace the latest branch tree even if it changed since download. Defaults to false. Preserves history by creating a normal commit; concurrent writes can still cause a conflict.  
   param name: uploadId | type: string | description: Identifier returned by GenerateGitCodeStoreProjectUploadUrl. The ZIP must have been uploaded within the last hour. | required: true | validation: format GUID
 Return type: PROMISE<CommitGitCodeStoreProjectUploadResponse>
  - name: revision | type: Revision | description: New revision, or the existing revision when the file tree is unchanged.  
     - name: _id | type: string | description: Revision identifier  | read-only: true | validation: maxLength 40
     - name: description | type: string | description: Revision description message  | read-only: true | validation: maxLength 2000
     - name: creationTime | type: Date | description: Creation time  | read-only: true 
     - name: author | type: Author | description: Author details  
        - name: name | type: string | description: Author name  | read-only: true | validation: maxLength 100
        - name: email | type: string | description: Author email  | read-only: true | validation: format EMAIL
  - name: branchName | type: string | description: Resolved branch name.  | validation: minLength 1, maxLength 250
  - name: changed | type: boolean | description: Whether a replacement commit was created.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: REPOSITORY_ARCHIVE_TOO_LARGE | Description: The upload exceeds 64 MiB compressed, 256 MiB expanded, or 10,000 ZIP entries (including directories).
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_REPOSITORY_ARCHIVE | Description: The ZIP is corrupt or contains unsafe or unsupported entries. Also returned for a malformed project GUID, an invalid `expectedHeadRevisionId` when force is false, or missing or blank commit metadata.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: REPOSITORY_UPLOAD_NOT_FOUND | Description: Couldn't find the upload. It may belong to another project, be at least 1 hour old, or have changed while being read.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: GIT_BRANCH_NOT_FOUND | Description: Couldn't find the target branch.
   HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: GIT_HEAD_COMMIT_MISMATCH | Description: The branch head differs from `expectedHeadRevisionId`, including when the uploaded tree is unchanged.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: GIT_PUSH_CONFLICT | Description: The remote branch changed before the push completed. Download the current tree and reconcile before retrying.


```

### Examples

### Commit the uploaded replacement tree
After the signed PUT succeeds, use its uploadId and the download response's revision._id. Requires authenticated Wix user and account context, plus the site context for a companion app. IDs and response values are illustrative.

```javascript
import { projects } from "@wix/git-code-store";

async function commitProjectUpload() {
  const response = await projects.commitGitCodeStoreProjectUpload(
    "72357e9a-2094-40b3-8626-9354a5089b49",
    "d9ef51cb-d776-4fc8-8d33-3ac139d2bb9a",
    {
      branchName: "main",
      expectedHeadRevisionId: "c1531e925af90ed3d1cb105d46e8c7282aecd630",
      commit: {
        message: "Update the homepage",
        author: { name: "Jane Doe", email: "jane.doe@example.com" },
      },
    },
  );
  return response;
}

/* Promise resolves to:
 * {
 *   revision: {
 *     _id: "ee542d628d90eb1fa18e32f40f7caa62bc391078",
 *     description: "Update the homepage",
 *     creationTime: new Date("2026-10-12T10:06:00Z"),
 *     author: { name: "Jane Doe", email: "jane.doe@example.com" }
 *   },
 *   branchName: "main",
 *   changed: true
 * }
 */

```

### commitGitCodeStoreProjectUpload (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { projects } from '@wix/git-code-store';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { projects },
  // Include the auth strategy and host as relevant
});


async function commitGitCodeStoreProjectUpload(managedProjectId,uploadId,options) {
  const response = await myWixClient.projects.commitGitCodeStoreProjectUpload(managedProjectId,uploadId,options);
};
```

---