> For the complete documentation index, see [llms.txt](https://studio-docs.sandbox.game/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://studio-docs.sandbox.game/source-control/connecting-git-to-your-project.md).

# Connecting Git to your project

Use this process when Git is installed and you want to start tracking a Sandbox Studio project. Connecting Git creates a project history and links the local project to a remote repository when your team uses one.

## Step 1: Open the project folder

Open a terminal in the root folder of your Sandbox Studio project.

1. Open the project in your editor or file explorer.
2. Open Git Bash or a terminal from the project root.
3. Confirm you can see project files such as package.json, assets, or src if they exist in your project.

The terminal path shows the project folder before you run Git commands.

{% hint style="info" %}
*TIP: Git commands should run from the project root, not from Downloads or a parent folder.*
{% endhint %}

## Step 2: Check whether Git is already active

Run git status to see whether the folder is already a Git repository.

1. Type git status and press Enter.
2. Look for a branch name or a message saying the folder is not a Git repository.
3. Stop here if the project is already connected and you only needed to confirm it.

git status

The terminal confirms whether Git is already tracking this folder.

## Step 3: Initialize Git if needed

Create a Git repository only if git status says the folder is not already a repository.

1. Run git init.
2. Run git status again.
3. Confirm Git now shows files ready to be tracked.

git init

git status

{% hint style="warning" %}
*WARNING: Do not run git init inside a nested folder if the project root is already tracked by Git. Nested repositories can make project files confusing to manage.*
{% endhint %}

## Step 4: Leave the SDK `.gitignore` in place

The project already has a `.gitignore`. The Genesys SDK writes the block between `# GENESYS-SDK-BEGIN` and `# GENESYS-SDK-END`. Do not delete that block. Add extra ignore lines only **below** `# GENESYS-SDK-END`.

| Ignored            | Why                                               |
| ------------------ | ------------------------------------------------- |
| `node_modules/`    | Dependencies; restored by `pnpm install`          |
| `.dist/`           | Build output; regenerated                         |
| `.editor/`         | Local editor build stamp                          |
| `.engine/`         | Copy of engine source; restored by `pnpm install` |
| `.turbo/`          | Build cache                                       |
| `.cursor/mcp.json` | Your MCP connection details — never commit        |

**Commit your scene.** `assets/` is tracked, including `*.genesys-scene`, prefabs, materials, and textures. `src/` is tracked too, including generated `auto-imports.ts` and `game-data.ts`. Those generated files belong in Git; never edit them by hand — see [Project code fundamentals](/best-practices/project-code-fundamentals.md). Also commit `package.json`, other configs, and `<Name>.genesys-project`.

```bash
git status
```

Review the untracked list. You should **not** see `node_modules/`, `.dist/`, `.engine/`, `.editor/`, or `.cursor/mcp.json`. You **should** see scene files and `src/` when they are new.

{% hint style="info" %}
*TIP: Common files to keep out of Git are already in the SDK ignore list. If `git status` shows `.cursor/mcp.json`, stop and restore the SDK `.gitignore` instead of adding that file.*
{% endhint %}

## Step 5: Create an empty GitHub repository

The local project needs a remote that is empty — no README, no `.gitignore`, no license — so the first push is only your Sandbox Studio files.

1. Open <https://github.com/new> while signed in.
2. Name the repository after the project.
3. Set it to **Private** unless your team wants it public.
4. Leave README, `.gitignore`, and license **unchecked**.
5. Create the repository and copy the HTTPS URL (`https://github.com/<you>/<repo>.git`).

## Step 6: Add the remote repository

Connect the local project to the GitHub URL you copied.

1. Run `git remote add origin` followed by the repository URL.
2. Run `git remote -v` to confirm the remote was added.

```bash
git remote add origin https://github.com/<you>/<repo>.git
git remote -v
```

The terminal shows `origin` for fetch and push, which means the local project knows where the remote repository is.

{% hint style="info" %}
*TIP: If `origin` already exists, run `git remote -v` to check whether it points to the correct repository before changing anything.*
{% endhint %}

## Step 7: Create the first commit

Commit the project files after you review what Git will track.

1. Run `git status`.
2. Run `git add .` for the files that belong in the project.
3. Run `git commit` with the message below.

```bash
git status
git add .
git commit -m "Initial project commit"
```

{% hint style="warning" %}
*WARNING: Do not commit secret files, credentials, or local machine settings. Remove them from the commit before continuing.*
{% endhint %}

## Step 8: Push the project

Send the first commit to the remote repository.

1. Run `git branch` to confirm the current branch name.
2. Run `git push -u origin` followed by the branch name.
3. Open the remote repository page and confirm the files appear.

```bash
git branch
git push -u origin main
```

The remote repository shows the project files after the first push.

{% hint style="info" %}
*TIP: Some repositories use main and some use master. Use the branch name shown by git branch.*
{% endhint %}

## Step 9: Confirm the connection

Run a final status check after the push.

1. Run git status.
2. Confirm the branch is clean or only has changes you understand.
3. Confirm the branch is tracking origin.

git status

The terminal confirms the local project and remote repository are connected.

## What You've Done

You have checked whether the project already used Git, initialized Git if needed, created an empty GitHub repository, connected `origin`, and pushed the first commit. The project now has a version history that can be used for [daily Git work](/source-control/daily-git-workflow.md) and collaboration.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://studio-docs.sandbox.game/source-control/connecting-git-to-your-project.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
