E2B icon

E2B

Run commands and manage E2B sandboxes and snapshots

Git → Checkout

AI-generated

Summary

Check out a specified branch, tag, or commit SHA in a Git repository inside an E2B sandbox.

Inputs

  • sandboxId (required) — The unique ID of the running E2B sandbox.
  • repositoryPath (required) — Absolute path to the Git repository folder inside the sandbox (e.g. /home/user/repo).
  • gitRef (required) — The Git branch name, tag, or commit SHA to check out.
  • timeoutSeconds — Maximum execution time for the operation in seconds. Defaults to 300.

Output shape

a single record

Returns a JSON object containing command execution details including sandboxId, operation ('git.checkout'), success status, exitCode, stdout, stderr, executionTimeMs, repositoryPath, and gitRef.

Examples

Example 1: Switch to a feature branch

Set Sandbox ID to 'sbx-123456', Repository Path to '/home/user/repo', and Git Ref to 'feature/login'.

Example 2: Checkout a specific commit SHA

Set Sandbox ID to 'sbx-123456', Repository Path to '/home/user/repo', and Git Ref to 'a1b2c3d4'.

Links

Discussion