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

# Change the commit hash of an existing repository.

> This will delete all existing files, update the commit hash, and
re-import the files from GitHub at the new commit.

Fails if the repository has active file comments or finding-file links.

# Access control rules

- Repository admin only.



## OpenAPI

````yaml PUT /api/v0/repositories/{repo_id}/commit-hash
openapi: 3.1.0
info:
  title: Cantina Client API
  description: >-
    Endpoints available to client organizations. For an overview and
    authentication, see
    https://docs.cantina.xyz/for-organizations/getting-started/api-access.
  license:
    name: Cantina
    identifier: Cantina
  version: 0.1.0
servers: []
security: []
paths:
  /api/v0/repositories/{repo_id}/commit-hash:
    put:
      tags:
        - repositories
      summary: Change the commit hash of an existing repository.
      description: |-
        This will delete all existing files, update the commit hash, and
        re-import the files from GitHub at the new commit.

        Fails if the repository has active file comments or finding-file links.

        # Access control rules

        - Repository admin only.
      operationId: change_commit_hash
      parameters:
        - name: repo_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangeCommitHash'
        required: true
      responses:
        '204':
          description: Commit hash changed and files re-imported
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '401':
          description: Access not authorised
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '403':
          description: Access forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
        '500':
          description: Error changing commit hash
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CantinaError'
components:
  schemas:
    ChangeCommitHash:
      type: object
      description: |-
        Change the commit hash of a repository, deleting all existing files
        and re-importing from GitHub.
      required:
        - commitHash
      properties:
        commitHash:
          type: string
    CantinaError:
      type: object
      description: Error returned by the Cantina API.
      required:
        - type
        - msg
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        msg:
          type: string
          description: Error message for the user.
    ErrorType:
      type: string
      description: Type of error.
      enum:
        - email_not_verified
        - auth_invalid
        - auth_expired
        - auth_token_missing
        - auth_id_missing
        - invalid_password
        - disabled_user
        - tc_not_accepted
        - evicted
        - unauthorized
        - bad_request
        - not_found
        - forbidden
        - gone
        - payload_too_large
        - service_unavailable
        - internal_error

````