# move_site_code_to_github

Source: https://modulify.ai/docs/mcp/code/move-site-code-to-github

Copies the repository of a site into a connected GitHub account, after which Modulify edits and publishes from there.

- Title: Move the code of a site into your GitHub
- Scope: `code:write`
- Access: Destructive

This is the **Move to your GitHub** row of the site's **Repository** section, covered in [Move a site's repository](https://modulify.ai/docs/editor/move-code-to-github#move-a-sites-repository). The code moves with its full history, and Modulify keeps editing and publishing from the new repository for as long as the Modulify app can reach it. It needs a paid plan and the **Transfer projects** permission, and it is refused while an AI edit or a publish is running.

Without `existing`, Modulify creates a new repository, which only works in a GitHub organisation. With `existing` set to `true`, the code goes into a repository you already have, in an organisation or a personal account, and every branch and tag that was in it is deleted and replaced, which Modulify cannot bring back. That repository has to be one the Modulify app can reach, not archived, without protected branches and not already holding another Modulify site. See [Move into an existing repository](https://modulify.ai/docs/editor/move-code-to-github#move-into-an-existing-repository).

The response only says the copy started, with the repository in `pending`. Editing and publishing pause until it finishes, which usually takes a few seconds and can take minutes for a large history, so read `get_site_repository` until `Status` is `connected`, or `failed` with the reason. A copy still unfinished 45 minutes after it started is given up. A failed move leaves the site with Modulify and removes a repository Modulify created for it, while a repository you picked keeps whatever the copy had already changed. The messages are listed in [If the move is refused or fails](https://modulify.ai/docs/editor/move-code-to-github#if-the-move-is-refused-or-fails).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `installationId` | string | Yes | The `_id` of a verified GitHub account from the `Installations` of `get_site_repository`, not the number GitHub gives the installation. |
| `repositoryName` | string | No | For a new repository, its name in letters, numbers, hyphens, underscores and dots, which defaults to the subdomain of the site. With `existing` set to `true`, the name of the repository to replace in that account. |
| `existing` | boolean | No | `true` to replace a repository you already have instead of creating a new one. Every branch and tag already in it is deleted. |