> This page is for version 0.2.1.
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/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/gym/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.orchestration.executors.git_ref

## Module Contents

### Functions

| Name                                                                                             | Description                                                                    |
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| [`_git`](#nemo_gym-orchestration-executors-git_ref-_git)                                         | -                                                                              |
| [`_ref_exists`](#nemo_gym-orchestration-executors-git_ref-_ref_exists)                           | -                                                                              |
| [`validate_gym_install_ref`](#nemo_gym-orchestration-executors-git_ref-validate_gym_install_ref) | Fail the submit early when `driver.gym_install.ref` cannot be found in `repo`. |

### Data

[`NEMO_GYM_SUBMIT_NO_REF_CHECK_ENV_VAR_NAME`](#nemo_gym-orchestration-executors-git_ref-NEMO_GYM_SUBMIT_NO_REF_CHECK_ENV_VAR_NAME)

[`_FULL_SHA`](#nemo_gym-orchestration-executors-git_ref-_FULL_SHA)

[`_GIT_ENV`](#nemo_gym-orchestration-executors-git_ref-_GIT_ENV)

[`_GIT_TIMEOUT_SECONDS`](#nemo_gym-orchestration-executors-git_ref-_GIT_TIMEOUT_SECONDS)

[`_HEX`](#nemo_gym-orchestration-executors-git_ref-_HEX)

[`logger`](#nemo_gym-orchestration-executors-git_ref-logger)

### API

```python
nemo_gym.orchestration.executors.git_ref._git(
    args: str = (),
    cwd: str | None = None
) -> subprocess.CompletedProcess
```

```python
nemo_gym.orchestration.executors.git_ref._ref_exists(
    repo: str,
    ref: str
) -> bool
```

```python
nemo_gym.orchestration.executors.git_ref.validate_gym_install_ref(
    config: nemo_gym.orchestration.api.SubmitConfig
) -> None
```

Fail the submit early when `driver.gym_install.ref` cannot be found in `repo`.

A branch or tag is looked up with one `git ls-remote`, which transfers only ref names. A full
commit hash that is not a branch/tag tip is probed with a depth-1, blob-less fetch. Any git
failure (unreachable or nonexistent repo, auth, timeout, git missing) also fails the submit;
set NEMO\_GYM\_SUBMIT\_NO\_REF\_CHECK=true to skip the check.

```python
nemo_gym.orchestration.executors.git_ref.NEMO_GYM_SUBMIT_NO_REF_CHECK_ENV_VAR_NAME = 'NEMO_GYM_SUBMIT_NO_REF_CHECK'
```

```python
nemo_gym.orchestration.executors.git_ref._FULL_SHA = re.compile('[0-9a-f]{40}')
```

```python
nemo_gym.orchestration.executors.git_ref._GIT_ENV = {None: os.environ, 'GIT_TERMINAL_PROMPT': '0', 'GIT_ASKPASS': 'true'}
```

```python
nemo_gym.orchestration.executors.git_ref._GIT_TIMEOUT_SECONDS = 10
```

```python
nemo_gym.orchestration.executors.git_ref._HEX = re.compile('[0-9a-f]{4,40}')
```

```python
nemo_gym.orchestration.executors.git_ref.logger = logging.getLogger(__name__)
```