> For the complete documentation index, see [llms.txt](https://notes.eliasnorrby.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.eliasnorrby.com/git/get-repository-root-path.md).

# Get the path to the repository root

It's often handy in scripts to get the (absolute) path to the current git repository.

```bash
git rev-parse --show-toplevel
```

Source: `LESS='-p ^\s*--show-toplevel' man git-rev-parse`
