> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runaether.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Import GitHub repo

> Links a GitHub repository to the project, and clones it into one of the project's workspaces when workspace_id is given.

Use this tool when you need to:
- Give a new project its repository
- Repair a project's GitHub access after GitHub was disconnected and connected again, by importing the same repository
- Clone the linked repository into a workspace of the project

Examples:
- POST /projects/{projectID}/github/import {"repo_url": "acme/widgets", "installation_id": 12345678}
- POST /projects/{projectID}/github/import {"repo_url": "https://github.com/acme/widgets", "workspace_id": "6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21"}

Hints:
- repo_url is owner/repo or a GitHub URL. installation_id is the GitHub App installation that reaches it (from listGithubRepos or getGithubRepo); without it only a public repository is read.
- A project keeps one repository for life: a different repository is refused with 409 and needs a new project; one already linked to another unarchived project of the organization is refused with 409 (use that project, or archive it first).
- The repository must have a commit and be at most 2 GB, and its default branch no surrounding whitespace, which would name another branch trimmed (400 otherwise, naming the branch). The link is kept when a clone fails, so the clone can be retried.
- Use saveTaskRepository instead to push the work of a task that has no repository to GitHub, into a new or picked repository or the project's own.
- Owners and admins of the project's organization, with push access to the repository on GitHub when installation_id is given: connecting a repository lets every member of the organization, viewers included, read its code. A member, viewer or billing member is refused with 403 org_role_insufficient, a project the caller cannot see is 404, and an agent host's grant acts as its owner. Refused with 404 for a repository the caller cannot reach or push to or a workspace not found, 400 for a workspace of another project, 401 when the caller has no GitHub App installation, 409 github_reconnect_required, 502 when GitHub fails to answer and 503 when the workspace cannot be started or the integration is disabled.



## OpenAPI

````yaml api-reference/openapi.json POST /projects/{projectID}/github/import
openapi: 3.1.0
info:
  title: Aether API
  version: 0.1.0
servers:
  - url: https://api.runaether.dev
security:
  - bearerAuth: []
paths:
  /projects/{projectID}/github/import:
    post:
      tags:
        - github
      summary: Import GitHub repo
      description: >-
        Links a GitHub repository to the project, and clones it into one of the
        project's workspaces when workspace_id is given.


        Use this tool when you need to:

        - Give a new project its repository

        - Repair a project's GitHub access after GitHub was disconnected and
        connected again, by importing the same repository

        - Clone the linked repository into a workspace of the project


        Examples:

        - POST /projects/{projectID}/github/import {"repo_url": "acme/widgets",
        "installation_id": 12345678}

        - POST /projects/{projectID}/github/import {"repo_url":
        "https://github.com/acme/widgets", "workspace_id":
        "6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21"}


        Hints:

        - repo_url is owner/repo or a GitHub URL. installation_id is the GitHub
        App installation that reaches it (from listGithubRepos or
        getGithubRepo); without it only a public repository is read.

        - A project keeps one repository for life: a different repository is
        refused with 409 and needs a new project; one already linked to another
        unarchived project of the organization is refused with 409 (use that
        project, or archive it first).

        - The repository must have a commit and be at most 2 GB, and its default
        branch no surrounding whitespace, which would name another branch
        trimmed (400 otherwise, naming the branch). The link is kept when a
        clone fails, so the clone can be retried.

        - Use saveTaskRepository instead to push the work of a task that has no
        repository to GitHub, into a new or picked repository or the project's
        own.

        - Owners and admins of the project's organization, with push access to
        the repository on GitHub when installation_id is given: connecting a
        repository lets every member of the organization, viewers included, read
        its code. A member, viewer or billing member is refused with 403
        org_role_insufficient, a project the caller cannot see is 404, and an
        agent host's grant acts as its owner. Refused with 404 for a repository
        the caller cannot reach or push to or a workspace not found, 400 for a
        workspace of another project, 401 when the caller has no GitHub App
        installation, 409 github_reconnect_required, 502 when GitHub fails to
        answer and 503 when the workspace cannot be started or the integration
        is disabled.
      operationId: importGithubRepo
      parameters:
        - in: path
          name: projectID
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GitHubImportInput'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GitHubProjectLink'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/GithubErrorResponse'
                  - $ref: '#/components/schemas/OrgAuthorizationErrorResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Conflict
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Gone
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Internal Server Error
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Bad Gateway
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GithubErrorResponse'
          description: Service Unavailable
components:
  schemas:
    GitHubImportInput:
      additionalProperties: false
      properties:
        installation_id:
          format: int64
          minimum: 1
          type: integer
        repo_url:
          minLength: 1
          type: string
        workspace_id:
          format: uuid
          type: string
      required:
        - repo_url
      type: object
    GitHubProjectLink:
      discriminator:
        mapping:
          linked: '#/components/schemas/LinkedGitHubProjectLink'
          unlinked: '#/components/schemas/UnlinkedGitHubProjectLink'
        propertyName: state
      oneOf:
        - $ref: '#/components/schemas/LinkedGitHubProjectLink'
        - $ref: '#/components/schemas/UnlinkedGitHubProjectLink'
    GithubErrorResponse:
      additionalProperties: false
      properties:
        code:
          enum:
            - account_deleting
            - bad_gateway
            - bad_request
            - cli_upgrade_required
            - client_outdated
            - conflict
            - control_forbidden
            - creator_github_access_missing
            - forbidden
            - gateway_timeout
            - github_claim_unverified
            - github_identity_mismatch
            - github_reconnect_required
            - github_ref_not_found
            - gone
            - internal_error
            - method_not_allowed
            - no_dispatch_target
            - not_acceptable
            - not_found
            - not_implemented
            - org_role_insufficient
            - org_suspended
            - payment_required
            - precondition_failed
            - project_archived
            - project_has_no_repository
            - project_repo_disconnected
            - project_repository_differs
            - push_file_too_large
            - push_rejected
            - push_secret_detected
            - rate_limited
            - repository_administration_not_granted
            - repository_already_connected
            - repository_create_forbidden
            - repository_create_rejected
            - repository_created_not_linked
            - repository_owner_not_caller
            - request_canceled
            - request_timeout
            - request_too_large
            - save_in_progress
            - save_requires_task_creator
            - service_unavailable
            - task_already_saved
            - task_backed_by_work_tree
            - task_bound_at_creation
            - task_branch_diverged
            - task_branch_is_default
            - task_branch_mismatch
            - task_branch_missing
            - task_creator_deleted
            - task_executing
            - task_file_too_large
            - task_has_no_commits
            - task_has_no_files
            - task_history_has_merges
            - task_is_child
            - task_not_started
            - task_rebase_in_progress
            - unauthenticated
            - unsupported_media_type
            - validation_failed
            - working_tree_dirty
            - workspace_gone
            - workspace_outdated
          minLength: 1
          type: string
        error:
          minLength: 1
          type: string
        errors:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
      required:
        - error
        - code
      type: object
    OrgAuthorizationErrorResponse:
      additionalProperties: false
      properties:
        code:
          enum:
            - org_membership_required
            - org_role_insufficient
            - org_suspended
            - account_deleting
            - agent_host_route_not_allowed
            - credential_kind_not_admitted
            - grant_scope_insufficient
          type: string
        error:
          minLength: 1
          type: string
      required:
        - error
        - code
      type: object
    LinkedGitHubProjectLink:
      additionalProperties: false
      properties:
        clone_url:
          format: uri
          type: string
        default_branch:
          minLength: 1
          type: string
        repo_full_name:
          minLength: 1
          type: string
        repo_name:
          minLength: 1
          type: string
        repo_owner:
          minLength: 1
          type: string
        state:
          enum:
            - linked
          type: string
      required:
        - state
        - repo_owner
        - repo_name
        - repo_full_name
        - default_branch
        - clone_url
      type: object
    UnlinkedGitHubProjectLink:
      additionalProperties: false
      properties:
        state:
          enum:
            - unlinked
          type: string
      required:
        - state
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.