> 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

## Resource: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/api-reference/account-level/git-codestore/introduction.md

## Article Content:

# About the Git Code Store Projects API

The Git Code Store Projects API lets you transfer a managed project's Git repository as a ZIP archive to inspect or edit its code outside Wix.

With the Git Code Store Projects API, you can:

- Download the tracked files from a branch or revision.
- Upload a complete replacement file tree and commit it to a branch while preserving Git history.

Uploading a ZIP stages its contents. The repository changes only when you commit the upload. Committing creates a normal child commit and preserves Git history. It doesn't publish or deploy the app.

## Before you begin

It's important to note the following points before starting to code:

- Call the API with an authenticated Wix user and their logged-in account context. For a project backed by a companion app, also provide the project's site context. The service verifies that the site belongs to the project's app and checks the user's permissions on that site. For other apps, it checks the user's permissions on the stored app in its owning account.
- REST requests use the base URL `https://www.wixapis.com/codestore/v2/git-code-store-projects`. The examples use `<AUTH>` for an authorization value representing the authenticated user. For companion apps, send the site's ID in the `wix-site-id` header. The site ID selects the context. It doesn't grant access or replace the user's identity.
- Downloading requires read access. Generating an upload URL and committing an upload require update access. API-key, app-only, and anonymous identities are not supported.
- The API returns temporary signed URLs for transferring ZIP files. Use HTTP GET to download and HTTP PUT to upload, including any returned headers. These URLs authorize the transfer without additional Wix authentication. Treat them as credentials and don't share or log them.
- You need the ID of an existing `AppManagedProject` with a Git repository. Use this ID as `managedProjectId` throughout the download, upload, and commit flow. A site ID or a legacy v1 Code Store project ID is not a substitute. These three operations do not create or discover managed projects.
- Use an existing branch. The branch defaults to `main` when omitted. A revision ID is a full 40-character Git commit SHA. When downloading an older revision, it must be reachable from the selected branch.
- An upload replaces the complete tracked file tree. Files omitted from the ZIP are deleted. An empty ZIP removes all files.
- Signed transfer URLs expire after 5 minutes, or earlier if their credentials expire or are revoked. Commit an uploaded ZIP within 1 hour.
- Use the downloaded revision ID as `expectedHeadRevisionId` when committing to prevent overwriting intervening changes.

## Archive limits

The API enforces the following archive limits:

| Limit | Download | Upload |
| --- | --- | --- |
| Compressed ZIP size | 64 MiB | 64 MiB |
| Total expanded content | 256 MiB | 256 MiB |
| Count | 10,000 tracked files | 10,000 ZIP entries, including directories |

Download limits are checked when generating the archive. Upload limits are checked when committing. A successful signed PUT does not mean the archive is valid or within these limits. Exceeding a limit returns `REPOSITORY_ARCHIVE_TOO_LARGE`.

## Supported archive contents

ZIP entries represent paths relative to the repository root. Put the repository's contents at the archive root, without an extra enclosing project directory. Regular files, executable files, directories, and supported symbolic links can be uploaded. Downloads include hidden files and materialized Git LFS content, but exclude Git history.

- Use a ZIP tool that preserves Unix file types and permission bits. Executable permissions and symbolic links are restored from this metadata. If your ZIP tool drops executable bits or stores a symbolic link as a regular file, the committed tree loses that information.
- Paths can contain at most 1,024 characters. Use `/` between path components.
- Absolute paths, empty components, `.` and `..` components, `.git` components in any letter case, backslashes, colons, and characters below U+0020 are rejected. A leading `./` and directory entries ending in `/` are accepted on upload.
- A path component must not end in a dot or space. For example, `src/file.` is rejected.
- Upload entry paths must be unique ignoring letter case. For example, `README.md` and `readme.md` can't both appear. A file or symbolic link can't also be the parent directory of another entry.
- Symbolic links must use relative targets that resolve to existing content inside the repository tree. Dangling links, cycles, links escaping the tree, and targets containing a `.git` component are rejected.
- Git submodules and special files such as devices or FIFOs are unsupported. Uploaded ZIP entries must be readable and have matching content sizes and checksums.

Unsupported or malformed archives return `INVALID_REPOSITORY_ARCHIVE`. This code can also indicate invalid commit metadata or an invalid expected head. Check the error message before rebuilding the ZIP.

## Use cases

- Download a project's code for local inspection.
- Update a project's code from a complete replacement ZIP.
- Recover from an interrupted commit without overwriting concurrent changes.

The [Sample Flows](https://dev.wix.com/docs/api-reference/account-level/git-codestore/sample-flows.md) article describes these workflows. The [Transfer Repository Archives](https://dev.wix.com/docs/api-reference/account-level/git-codestore/transfer-repository-archives.md) article shows the signed HTTP transfers used in them.

## Terminology

- Managed project: The project whose Git repository you access with `managedProjectId`.
- Staged upload: A ZIP stored temporarily under an `uploadId`. Its contents affect the repository only after you commit it.

@sdk_package_setup