# read_git_commit_sha_via_subprocess

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/_git/read_git_commit_sha_via_subprocess)

Fall back to `git rev-parse HEAD` for unusual repository layouts.

## Signature

```python
read_git_commit_sha_via_subprocess(
    path: str | Path,
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `path` | `str \| Path` | Yes | Directory or file path inside a repository. |

## Returns

`str`

The full commit SHA reported by git, or an empty string on failure.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e14e0adcbe78565ed3650e7f24b2a775d5437d25/libs/code/deepagents_code/_git.py#L326)