---
title: "AI Studio Git Sync and Code Download"
description: "Get your AI Studio code out: sync a project with GitHub in both directions, manage branches and history, or download the codebase or any past version as a ZIP."
url: https://help.aesthetixcrm.com/en/articles/2246-ai-studio-git-sync-and-code-download
collection: "AI Studio"
updated: 2026-11-20
language: en
---

# AI Studio Git Sync and Code Download

Get your AI Studio code out: sync a project with GitHub in both directions, manage branches and history, or download the codebase or any past version as a ZIP.

You can take your AI Studio project's code with you in two ways: Git Sync keeps the project in step with a GitHub repository, and Download Codebase exports a ZIP file. Both live inside the AI Studio builder (AI Agents > AI Studio, open a project). They suit backups, handing the project to a developer, editing in an outside tool, or hosting the app yourself.

> **Keep PHI out of your code:** AI Studio is an AI feature and is not approved for Protected Health Information (PHI). Never put patient data into AI Studio prompts, project files, databases or storage, and do not commit PHI or credentials to a GitHub repository. Anything in the project can end up in GitHub or a ZIP on someone's computer.

## Which option should I use?

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p><strong>Goal</strong></p></th><th colspan="1" rowspan="1"><p><strong>Use</strong></p></th></tr><tr><td colspan="1" rowspan="1"><p>Keep a live backup and let a developer work in their own tools</p></td><td colspan="1" rowspan="1"><p>Git Sync with GitHub</p></td></tr><tr><td colspan="1" rowspan="1"><p>A one-time copy, an older version, or to host the code yourself</p></td><td colspan="1" rowspan="1"><p>Download Codebase (ZIP)</p></td></tr><tr><td colspan="1" rowspan="1"><p>Compare earlier versions of your project</p></td><td colspan="1" rowspan="1"><p>Download previous versions from Version History</p></td></tr></tbody></table>

## Git Sync with GitHub

Git Sync is a two-way integration that keeps code synchronized between AI Studio and a connected Git repository. When you connect GitHub, AI Studio automatically creates a **private** repository for your project and pushes its initial version. It lets you:

-   **Sync automatically:** push saved AI Studio versions to GitHub and pull outside commits back into AI Studio.
    
-   **Use external development tools:** edit the code in tools such as Cursor, Claude Code, Codex, GitHub Copilot or Gemini CLI without moving files by hand.
    
-   **Track changes:** keep project versions and Git commit history.
    
-   **Review updates:** a new preview build is generated after outside changes are pulled.
    
-   **Manage development:** switch branches, watch sync activity and resolve conflicts.
    

Git Sync supports React (Vite) and TanStack Start projects, including dependency and lockfile changes. Images, fonts and other binary files are preserved, though the AI Studio Code Editor cannot preview binary files. Git Sync is optional; projects without a Git connection work normally. This guide covers GitHub; support for other Git providers, including privately hosted repositories, may vary.

### Before you begin

Your user needs the **Manage Git & download code** permission under **Settings** > **Team** > **Permissions** > **AI Studio**. It is enabled by default for standard roles. Have a GitHub account ready (personal or organization). Organization members may need an administrator to approve the connection.

### Set up Git Sync with GitHub

1.  In your account, open **AI Agents** > **AI Studio** and select your project.
    
2.  Click **More** > **Git**, then select **GitHub**.
    
3.  Click **\+ Add connection** to connect a new GitHub account. If your account is already listed, click **Connect**.
    
4.  Choose **My GitHub account** or **Organization**, then choose who can use the connection:
    
    -   **Only me:** available only to you.
        
    -   **Account:** available to other users in your account, subject to their permissions.
        
5.  Click **Continue on GitHub**.
    
6.  On GitHub, install and authorize **Lead Connector**. This is the expected GitHub consent screen for the Aesthetix CRM platform and is safe to approve. Complete any verification GitHub asks for.
    
7.  Return to AI Studio and let the connection finish. AI Studio creates a private repository, pushes the initial version and connects to the `main` branch.
    
8.  Confirm **Automatic Push** and **Automatic Pull** are on. Both are on by default.
    
    ![](https://files.us.gleap.ai/pf/g/640067b236b432d4bc3c20bb-FlAVD0T1BX5MDAUnUmnqnxIYbYLUQQT0Vsy6nZK3lThGZyLhBslI1io11NkrwzVDPr7QIqPNWKD.png?v=1&k=us1&s=api&e=1795348800&sig=IGnN3257W3cyJHTJ0uIs9-KJ_tzJc1W3y8esAvwKsBc)

### Automatic push and pull

Both settings can be turned off independently.

-   **Automatic Push:** every saved AI Studio version goes to GitHub, including AI-generated changes, code edits, visual edits and restored versions. Commits keep their history and are attributed to a LeadConnector service identity rather than your personal GitHub identity. That is expected.
    
-   **Automatic Pull:** new commits on the connected GitHub branch are pulled into AI Studio. Each commit creates a new project version, shows the changed files in a chat card, and generates an updated preview.
    

When the preview is ready, click **Refresh preview** to see the changes. Use **Push now** or **Pull now** under **More** > **Git** to sync manually, even if automatic sync is off.

### Sync conflicts

If both GitHub and AI Studio have new commits, the branch is marked **diverged** in Git settings. Click **Review and resolve** and choose:

-   **Force push:** keeps the AI Studio version and can overwrite the divergent commits on GitHub.
    
-   **New branch:** pushes the AI Studio changes to a new branch, preserving both versions. This is the safer choice when you are unsure.
    

### Secret scanning

Git Sync scans outgoing changes for credentials. Recognized secrets block the push; code that looks like a hardcoded credential produces a warning. Keep API keys in AI Studio Secrets (see "AI Studio Full-Stack Development: SSR, Server Functions, REST APIs and Secrets"), never in the code you sync.

## Manage Git Sync

### Switch or create a branch

Git Sync uses `main` by default.

1.  Open your project and go to **More** > **Git**.
    
2.  Use the branch selector to pick an existing branch or enter a new branch name.
    
    ![](https://files.us.gleap.ai/pf/g/640067b236b432d4bc3c20bb-VbsO78fAQXU5k1uodXqtE5MyFI3xdBzM1wL12qnYWIARBG0euMlmK8jSTxLSaNmKb4zkZBZUe0c.png?v=1&k=us1&s=api&e=1795348800&sig=E7caDiLCTl1J-15GftlM7v4F_mHSYNy9aXbRck3Qfiw)
3.  Confirm. If the branch does not exist, AI Studio creates it on the next push.
    

Only the selected branch receives incoming commits. Changes on other branches are not pulled until you switch to them.

### View sync history

1.  Open **More** > **Git**.
    
2.  Select **Sync History** to see recent pushes, pulls, commit records and errors.
    

You can also see total syncs, success rate and links to individual commits on GitHub. Failed operations include details about what went wrong.

![](https://files.us.gleap.ai/pf/g/640067b236b432d4bc3c20bb-2n0Npnv2b1PEchKC1po9c6eCnOllzi2KsTTZvSoAu6NuRXiI8fOY2LfcY6444x73cNtPOCL38wp.png?v=1&k=us1&s=api&e=1795348800&sig=H_IZZWqaHycMhX6ZcKDZ8d1JOugDf9oBbT9g4QQwvqY)

### Disconnect or reconnect GitHub

From **More** > **Git**, use **Disconnect** to remove the GitHub connection from the project, or reconnect an account when its authorization needs renewing. When you reconnect a previously connected project, AI Studio can reuse its existing repository instead of creating a new one, and it does not force-push on its own.

![](https://files.us.gleap.ai/pf/g/640067b236b432d4bc3c20bb-0SOUYinkwpuprxDFlc78vbhjsezgaDyUquhupG2lDIR5qa8SfCUt2MMe3oftbghnsoacgirmI1J.png?v=1&k=us1&s=api&e=1795348800&sig=OZnQ5pvCzu9W_jnh03xIQBIJPkXUqa2muonKFrd7hng)

## Download the codebase as a ZIP

Download Codebase exports your whole project as a ZIP of all project files and code. The download is a copy; your AI Studio project is not changed.

### Download the current version

Option 1, from the Code section:

1.  Click **Code** in the top navigation of your AI Studio project.
    
2.  Scroll to the bottom of the Code section.
    
3.  Click **Download Codebase**. The ZIP saves to your default download location.
    
    ![](https://files.us.gleap.ai/pf/g/640067b236b432d4bc3c20bb-sXjcfwsh1YXQK3iDzy7I6ah8DFe8m5HI1wncwUeQUEz0XwatQ4IZu2D8lDB8MKl8sRuX3WYces9.png?v=1&k=us1&s=api&e=1795348800&sig=FUPnqKiXY9T_tTzddkUhQ3NOPy2DJclN0z5dc4cL_jk)

Option 2, from Project Settings:

1.  Open **Project Settings**.
    
2.  Find **Download source code** and click it.
    
    ![](https://files.us.gleap.ai/pf/g/640067b236b432d4bc3c20bb-NKSjz8kzSvqiTnRUZGBZ0YQ3vyyuUiEEqAqXr09BnvhyQ5je5mYyCTgLjRiMZ0s5ozufFJqiHTD.png?v=1&k=us1&s=api&e=1795348800&sig=F1lYdqMXRs_u3P1G1MGLQsYA4uoJmDEhNt-25ulKWaU)

### Download a previous version

1.  Open your project's **Version History**.
    
2.  Find the version you want and click the three-dot menu next to it.
    
3.  Select **Download ZIP**.
    

Each version download is an independent ZIP of the code as it was at that point, so you can download several to compare changes or recover an earlier implementation. You can download as many versions as exist in Version History.

### What is in the ZIP

The ZIP contains your complete project codebase: HTML, CSS, JavaScript, configuration files, assets and other files that make up the project. There is no stated size limit; larger projects take longer to prepare.

### After you download

Extract the ZIP into a folder on your computer. You can open it in a code editor or development environment, run or modify it locally, or deploy it to your own hosting. Running locally needs a developer environment (the project is a React/Vite or TanStack Start app, so Node.js and the project's package install command are required). A developer can follow the project's configuration files. Server-side secrets are not included in the code; supply your own values wherever the app expects them.

The code you build and download is yours to use, including commercially or on external servers. Anything that depends on AI Studio services (for example Cloud) will not work outside AI Studio until reconfigured.

### Bringing changes back

The ZIP download is for exporting. To bring outside edits back, either use Git Sync (preferred, since pulls are automatic) or copy updated code sections into the AI Studio Code Editor manually.

## Cautions

-   Edits made in GitHub sync back into AI Studio when Automatic Pull is on, and they create new project versions.
    
-   If both sides change at once, resolve the conflict deliberately; **Force push** can overwrite GitHub commits.
    
-   Do not commit secrets, credentials or PHI. The repository is private, but anyone with access can read it.
    
-   Downloading or syncing requires the **Manage Git & download code** permission, and you can only download projects you have access to.
    

## Troubleshooting

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p><strong>Problem</strong></p></th><th colspan="1" rowspan="1"><p><strong>What to check</strong></p></th></tr><tr><td colspan="1" rowspan="1"><p>No <strong>Git</strong> option or connection fails</p></td><td colspan="1" rowspan="1"><p>Confirm your user has the <strong>Manage Git &amp; download code</strong> permission.</p></td></tr><tr><td colspan="1" rowspan="1"><p>GitHub authorization does not finish</p></td><td colspan="1" rowspan="1"><p>Complete any GitHub verification. Organization members may need an administrator to approve the app.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Push is blocked</p></td><td colspan="1" rowspan="1"><p>Git Sync found a recognized secret in outgoing changes. Remove it and store it as an AI Studio Secret.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Branch shows <strong>diverged</strong></p></td><td colspan="1" rowspan="1"><p>Both sides changed. Use <strong>Review and resolve</strong> and choose <strong>New branch</strong> to keep both.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Outside commits are not appearing</p></td><td colspan="1" rowspan="1"><p>Check <strong>Automatic Pull</strong> is on and the commit is on the selected branch; otherwise use <strong>Pull now</strong>.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Preview looks stale after a pull</p></td><td colspan="1" rowspan="1"><p>Click <strong>Refresh preview</strong> once the new preview is ready.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Sync failures</p></td><td colspan="1" rowspan="1"><p>Open <strong>Sync History</strong> for the error details.</p></td></tr><tr><td colspan="1" rowspan="1"><p>Binary files will not preview</p></td><td colspan="1" rowspan="1"><p>The Code Editor cannot preview binary files, but they are preserved in sync.</p></td></tr></tbody></table>

## Frequently Asked Questions

**What happens to my AI Studio project when I download the code?**

Nothing. Download creates a copy; the original project is unchanged and you can keep working.

**Does Git Sync create a repository for me?**

Yes. When you connect GitHub, AI Studio creates a private repository for the project and pushes the initial version to the `main` branch.

**Whose name appears on the commits?**

Commits pushed from AI Studio are attributed to a LeadConnector service identity, not your personal GitHub identity. That is expected.

**What is the difference between Force push and New branch?**

Force push keeps the AI Studio version and may overwrite divergent GitHub commits. New branch pushes the AI Studio changes to a new branch so both versions are kept.

**Can I turn off automatic syncing?**

Yes. Automatic Push and Automatic Pull can be turned off independently, and you can still use **Push now** and **Pull now**.

**Can I download an older version of my project?**

Yes. Open **Version History**, use the three-dot menu on a version and choose **Download ZIP**. Each version is a separate ZIP.

**Can I upload the ZIP back into AI Studio?**

Download is for export. To bring changes back, use Git Sync or copy updated sections into the Code Editor.

**Does Git Sync work with other Git providers?**

This guide covers GitHub. Support for other Git-based providers, including privately hosted ones, may vary.

**Can I use downloaded code commercially or host it elsewhere?**

Yes. The code is yours to use, including commercially or on your own servers.

**Is it safe to store patient information in the repository or ZIP?**

No. AI Studio is not approved for PHI, so keep patient data out of the project, repository and downloads.
