> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deepest.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Work with Git and GitHub

> Clone and inspect repositories inside a Computer, set up third-party authentication separately, and preserve work safely.

Git is included in the Developer Image. Use it inside the Computer through SSH, the Console command view, or an Agent's Exec calls. The repository, its working tree and local commits are stored on that Computer's disk.

Signing in to Deepest with GitHub does not automatically authorize GitHub repository access inside the Guest. Deepest SSH authorization and GitHub SSH authorization also serve different connections.

## Inspect before cloning

In the Computer, confirm your tools and choose a directory you own:

```bash theme={null}
git --version
pwd
ls -la
mkdir -p /root/projects
```

If your repository is already present, use it rather than creating another clone. Read its `README` and any repository-specific instructions before installing dependencies or running scripts.

To clone a public repository you intend to use:

```bash theme={null}
git clone https://github.com/<OWNER>/<REPOSITORY>.git /root/projects/<REPOSITORY>
cd /root/projects/<REPOSITORY>
git status --short --branch
git remote -v
```

Replace placeholders with the intended repository. Successful clone and status show that source is present; they do not authorize pushes or prove the build works. Avoid embedding tokens in remote URLs.

## Configure private access deliberately

Use a GitHub-supported authentication method with the least permissions needed for the task. For example, you can install GitHub CLI following its official instructions, then interactively authenticate in the Computer:

```bash theme={null}
command -v gh
gh --version
gh auth login
gh auth status
```

GitHub CLI is a catalog guide, not one of the six platform Quick Install tools and not guaranteed preinstalled by the image. Check before using it. The official [GitHub CLI authentication manual](https://cli.github.com/manual/gh_auth_login) maintains its current login options.

An alternative is a dedicated GitHub SSH key created inside the Computer and registered at GitHub. That key authorizes **Computer → GitHub**, while the public key added to Deepest authorizes **your local client → Computer**. Do not copy your local private SSH key into the Guest just to conflate these two relationships.

The official [GitHub SSH guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh) covers key setup and provider authorization. Organization SSO and repository policy still apply.

Vault can support specific HTTPS Authorization-header API requests, but it is not automatic Git credential-helper integration. Do not assume every Git authentication scheme or GitHub CLI storage method is covered by [Vault substitution](https://docs.deepest.dev/security/vault.md).

## Verify work and preserve it

After making changes, inspect the exact diff:

```bash theme={null}
git status --short
git diff --check
git diff
```

Commit only intended files, using your own configured author identity. A commit stores history in that repository; a push changes a remote repository and requires separate user intent and permissions.

The Computer's disk survives normal Stop/Start, including local commits and uncommitted saved files. Running tests, editor processes and in-memory state do not survive Stop. A Clone copies Guest repository and credential files as ordinary disk contents, so review duplicates and third-party sessions before operating both copies.

A local Computer snapshot is not an external backup. Push intended commits or export a verified copy when you need a separate durable location. Do not delete the Computer until required work has been exported and checked.

## Agent workflow

With an authenticated SDK client, a read-only repository check can be:

```js theme={null}
const reply = await deepest.computer(computerId).exec({
  command: "git",
  args: ["-C", "/root/projects/<REPOSITORY>", "status", "--short", "--branch"],
  timeout_ms: 10000,
});
if (!reply.ok) throw new Error(reply.error.code + " / " + reply.retry);
console.log(reply.result.stdout);
console.log({ exit_code: reply.result.exit_code, timed_out: reply.result.timed_out });
```

Replace the repository path before running. Pass arguments explicitly instead of interpolating untrusted text into a shell command. Keep Account Agent Keys in the trusted caller.

Agents should inspect the working tree, respect uncommitted work, read the project's instructions, and obtain the user's intended branch/remote action before destructive changes or publishing. If a clone or push response is lost, inspect local and remote state before repeating it.

## Resource and failure boundaries

Repositories, dependency directories, LFS objects and caches consume Account storage. Concurrent builds and Agents share CPU and the Computer's memory. Reuse an existing suitable Computer and repository when that fits the task.

| Problem | Recovery |
| - | - |
| Public clone cannot resolve GitHub | Check Guest DNS/outbound connectivity |
| Private clone/push denied | Verify provider identity, token/key permissions and organization policy |
| `gh` not found | Follow its catalog/official installation guide; it is not a guaranteed image command |
| Wrong changes or repository | Stop and inspect `pwd`, `git remote -v` and `git status` |
| Need files only | Use [SFTP](https://docs.deepest.dev/connect/sftp.md) with an explicit destination and integrity check |
| Disk pressure | Identify disposable caches and apply [storage recovery](https://docs.deepest.dev/computers/storage-reclaim.md) |
| Restore brought back old files | Disk rollback is expected; inspect commits/remote state before pushing |

Continue with [Agent tools](https://docs.deepest.dev/environment/agent-tools.md), [Docker and Dev Containers](https://docs.deepest.dev/environment/docker-and-dev-containers.md), or [VS Code Remote SSH](https://docs.deepest.dev/connect/vscode.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.