sync_from_git
Pull the configured remote git repository into this project's workspace — the same chain as the web app's pull button. Use when the user has a local/remote git repository they want reflected in this cloud project: they push it to GitHub/Gitee once and attach it to the project (web app settings, or REST PUT /api/v1/user/git/projects/<project_id>/config with the same X-API-Key), then call this tool to sync — file bytes never flow through the model context, unlike write_file/upload_file. Check get_git_status first to see the attached remote and how far behind the project is. Requires no unsaved local edits. Public HTTPS repositories need no credentials; a private one needs a GitHub/Gitee platform token added in the web app (other hosts: an SSH address with an SSH key bound in the web app). reason token_required means anonymous access was refused: the host answers the same for a private repository and for a wrong address, so check the URL first. reason address_blocked means the remote's host resolves to a private/local network address the platform refuses to reach, and reason network_error means it did not resolve at all or in time — in both the remote IS configured, so do not re-attach it; check the address with the user instead. reason credential_mismatch means the credentials the remote is bound to (a platform token) do not belong to its host — the user has to re-bind them in the web app. reason timeout means the pull ran out of its time budget (a large repository or a slow network) — the remote IS configured and nothing is wrong with it, so tell the user to try again later rather than re-attaching. Two 403/400 answers from the config endpoint are part of the X-API-Key contract, not your mistake: 403 GIT_CREDENTIAL_BINDING_REQUIRES_WEB — the key may not choose the user's ssh_key_id/platform_token_id (attach the remote without them); 400 GIT_CREDENTIAL_MISMATCH_REQUIRES_WEB — a legacy row binds a platform token to a host it may not serve, and only the user can re-select it in the web app. A PUT response with credentials_dropped: true means the new address started without the old one's credentials (push_strategy_downgraded says which automatic strategy was turned back to manual) — tell the user to bind credentials in the web app before expecting pushes or private pulls. The first sync into a project nobody has changed since create_project replaces its starter files with the remote's default branch (sync before opening it in the web editor, whose AI panel moves it onto a session branch). reason unrelated_history means the project has history of its own — check the remote URL, or create a new project and sync into that.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |