---
name: github-clone
description: Clone a GitHub repository into the workspace with git (authenticated when GITHUB_TOKEN is forwarded). Use when the task involves working with code from a specific GitHub repo.
---

# github-clone

Clone a repository into `/workspace/<repo>` and `cd` into it.

## How

Public repos:

```bash
git clone https://github.com/OWNER/NAME.git
cd NAME
```

Private repos require `GITHUB_TOKEN` to be forwarded into the container via
`LFG_PASS_ENV=GITHUB_TOKEN`. Use a credential helper so the token never lands
in `.git/config`:

```bash
git -c credential.helper='!f() { echo username=x-access-token; echo "password=$GITHUB_TOKEN"; }; f' \
    clone https://github.com/OWNER/NAME.git
cd NAME
```
