---
title: "preview the content of target file in the git repository"
method: POST
path: "/gitops/repo/file/preview"
tags: ["gitops"]
---

# preview the content of target file in the git repository

`POST /gitops/repo/file/preview`

Retrieve the compose file content based on git repository configuration
**Access policy**: authenticated

## Request body

- GitopsRepositoryFilePreviewPayload
  - `password` string — Password for git authentication. Deprecated: use SourceID instead
  - `reference` string
  - `repository` string — URL of a Git repository to preview. Deprecated: use SourceID instead
  - `sourceID` integer — SourceID resolves URL and auth from the stored Source record. When set, the inline Repository/Username/Password/TLSSkipVerify fields are ignored.
  - `targetFile` string — Path to file whose content will be read
  - `tlsSkipVerify` boolean — TLSSkipVerify skips SSL verification when cloning the Git repository. Deprecated: use SourceID instead
  - `username` string — Username for git authentication. Deprecated: use SourceID instead

## Response `200`

Success

- GitopsFileResponse
  - `FileContent` string

## Other responses

- `400` — Invalid request
- `404` — Source not found
- `500` — Server error

---

[API](https://skmtc.net/portainer/apis/portainerce-api.md) · [All operations](https://skmtc.net/portainer/apis/portainerce-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/portainer/portainerce-api/versions/c0b0975cd11b/schema)
