> This page is for version Latest (default).
> For other versions, use one of these documentation indexes:
> - Latest (default): https://docs.nvidia.com/nemo-helix/latest/llms.txt
> - 0.12: https://docs.nvidia.com/nemo-helix/v0.12/llms.txt
> - 0.11: https://docs.nvidia.com/nemo-helix/v0.11/llms.txt
> - 0.10: https://docs.nvidia.com/nemo-helix/v0.10/llms.txt
> - 0.9: https://docs.nvidia.com/nemo-helix/v0.9/llms.txt
> - 0.8: https://docs.nvidia.com/nemo-helix/v0.8/llms.txt
> - 0.7: https://docs.nvidia.com/nemo-helix/v0.7/llms.txt
> - 0.6: https://docs.nvidia.com/nemo-helix/v0.6/llms.txt
> - 0.5: https://docs.nvidia.com/nemo-helix/v0.5/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo-helix/llms.txt.

# Find Files in a Git Repository

POST http://localhost:8080/apis/files/v2/workspaces/{workspace}/git-repositories/find-files
Content-Type: application/json

Find every file with a given name in the commit a git storage config resolves to.

Without `known_hosts`, returns the host's public keys instead and reads nothing, as
ssh prompts on a first connection: confirm one key's fingerprint, then repeat the
request with only that key's `known_hosts_line`. This needs only the storage `url`.

With `known_hosts`, `ssh_key_secret` and `file_name` are required. It runs the same
checks as creating a fileset with this storage, without creating one. A fileset created afterwards from the same branch or tag
resolves it again, so if the branch has moved since, its files may differ.

Reference: https://docs.nvidia.com/nemo-helix/documentation/reference/api-reference/files/find-git-repository-files-apis-files-v-2-workspaces-workspace-git-repositories-find-files-post

## Request

### Path parameters

- `workspace` (string, required)

### Body (application/json)

This endpoint expects a FindGitRepositoryFilesRequest.

- `storage` (GitLookupStorageConfig, required) — The storage a git fileset would be created with. Leave known_hosts empty to get the host's keys; that needs only the url.
- `file_name` (string, optional) — A file name, without a directory, to look for anywhere under the storage path. Required with known_hosts.

## Response

### 200

Successful Response

- `host_keys` (list of SshHostKey, optional) — Set when the storage had no known_hosts: the keys the host presents, ed25519 first. Each was fetched over its own unverified connection, so confirm one key's fingerprint and repeat the request with only that key's known_hosts_line. The repository is not read.
- `revision` (string, optional) — The commit SHA the storage's revision resolved to. Unset when host_keys is set.
- `paths` (list of string, optional) — Paths of every file with that name, relative to the storage path. Empty when host_keys is set: the repository was not read, so an empty list then says nothing about its files.

## Errors

### 400 Bad Request Error

The storage, its secret, or its host was rejected

- `detail` (string, optional)

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 502 Bad Gateway Error

The host or repository could not be reached

- `detail` (string, optional)

## Types

### GitLookupStorageConfig

A git storage as find-files takes it: the SSH key is needed to read the repository, not to scan its host.

- `url` (string, required) — SSH remote, e.g. 'git@gitlab.example.com:org/repo.git' or 'ssh://host:2222/org/repo.git'
- `read_chunk_size` (integer, optional, default: 1048576) — Chunk size in bytes for reading/streaming files. Larger chunks reduce async overhead but increase memory per concurrent download. Default: 1MB.
- `type` ("git", optional, default: git)
- `revision` (string, optional, default: HEAD) — Branch, tag, or commit SHA. 'HEAD' resolves to the remote's default branch.
- `original_revision` (string, optional) — The original revision requested by the user before resolution (e.g., 'main'). The 'revision' field contains the resolved commit SHA.
- `path` (string, optional, default: ) — Optional directory within the repository. All paths are relative to it.
- `ssh_key_secret` (string, optional) — Secret holding an unencrypted SSH private key with read access. Required with known_hosts; not used to return the host's keys.
- `known_hosts` (string, optional, default: ) — known_hosts lines for the remote host, e.g. the output of `ssh-keyscan host` once its fingerprint has been checked against one obtained through a trusted channel. The host key is verified against these and nothing else. Required to read the repository; leave it empty only to have find-files return the host's keys.

### SshHostKey

- `key_type` (string, required) — Key algorithm, e.g. 'ssh-ed25519'
- `fingerprint` (string, required) — SHA256 fingerprint, in the form ssh prints it
- `known_hosts_line` (string, required) — The key as a known_hosts line. Store only the line of the key whose fingerprint was confirmed

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (map from string to any, optional)

### ValidationErrorLocItems

- string
- integer

## Examples

**Request**

```json
{
  "storage": {
    "url": "string"
  }
}
```

**Response**

```json
{
  "host_keys": [
    {
      "key_type": "string",
      "fingerprint": "string",
      "known_hosts_line": "string"
    }
  ],
  "revision": "string",
  "paths": [
    "string"
  ]
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8080/apis/files/v2/workspaces/workspace/git-repositories/find-files"

payload = { "storage": { "url": "string" } }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'http://localhost:8080/apis/files/v2/workspaces/workspace/git-repositories/find-files';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"storage":{"url":"string"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```