Haruno Knowledge base

Git inside the sandbox

In a sandboxed chat Haruno can look at your repository and make local commits with a short list of git commands. Anything that needs the network is refused.

  • Mac appAvailableThe Mac's isolated space has the full git program.
  • Windows appAvailable

Git is a tool that keeps the history of a folder of files. People who work with code use it all the time. In a sandboxed chat, Haruno can use git on your repository, with a short list of allowed commands.

When it works

Git works when the chat's folder is the top level of a repository: the folder that holds the repository's own .git folder.

It does not work, and Haruno says so, in these cases:

  • the chat is opened on a sub-folder of a repository;
  • the chat is opened on a folder that contains one or more repositories;
  • the chat has no folder of its own.

Then every git command is refused with fatal: this chat's folder is not the top level of a git repository, and git in this chat cannot create or open another one. The fix is to open the chat on the repository's top folder.

What Haruno can do

Kind of taskCommands
Look at the history and the changesstatus, log, show, diff, blame, grep, describe, shortlog, ls-files, ls-tree, cat-file, rev-parse, rev-list
Branches and tagsbranch, tag, switch, checkout, merge, revert, cherry-pick
Make local changesadd, restore, commit, reset, stash, mv, rm, clean, apply
Read settingsconfig (reading a value only), remote (reading remotes only), worktree list, version

A few are limited. stash show is not available, and Haruno uses git diff stash@{0} instead.

A commit uses the name and email already set for that repository, or on your PC. Haruno reads them when the chat starts. Changing them during the chat does not change who the commits belong to.

What it cannot do

  • Anything that needs a network. fetch, pull, push, clone and submodule are refused with fatal: this chat has no network, so git cannot reach a remote. Sending commits to a remote is something you do yourself.
  • Start a new repository. git init is refused. Haruno also cannot point git at another repository.
  • Interactive commands, such as rebase and bisect. There is nobody at a keyboard to answer them.
  • Things that run other programs. Repository hooks, aliases, editors, signing programs and external diff tools do not run. A command that depends on one behaves differently from your terminal.

If git is missing for a chat, the chat starts without it. A git command then answers git: this chat runs in an isolated session and git is not available here.

Reading GitHub is a different thing

Looking up an issue or a review on GitHub does not go through git. See Reading GitHub.

What to tell a customer

For everyday work, such as checking what changed and committing, git works in the chat. For anything that talks to a server, such as pushing, the customer does it themselves outside the chat.

Last updated · PR #2944 · View this version on GitHub

History (1 version)
  1. Internal knowledge base for staff: site, reader keys, assistant, 197 pages and the PR rule (#2944)
    What changed
    @@ -0,0 +1,54 @@
    +---
    +title: Git inside the sandbox
    +summary: In a sandboxed chat Haruno can look at your repository and make local commits with a short list of git commands. Anything that needs the network is refused.
    +feature: sandbox-git
    +covers:
    +  - windows-client/docs/sandbox-git.md
    +  - windows-client/Haruno.Desktop.Services/Sandbox/SandboxGitCommandPolicy.cs
    +  - windows-client/Haruno.Desktop.Services/Sandbox/SandboxGitRelay.cs
    +  - windows-client/Haruno.Desktop.Services/Chat/SandboxGitNotice.cs
    +---
    +
    +Git is a tool that keeps the history of a folder of files. People who work with code use it all the time. In a sandboxed chat, Haruno can use git on your repository, with a short list of allowed commands.
    +
    +## When it works
    +
    +Git works when the chat's folder is the **top level of a repository**: the folder that holds the repository's own `.git` folder.
    +
    +It does not work, and Haruno says so, in these cases:
    +
    +- the chat is opened on a **sub-folder** of a repository;
    +- the chat is opened on a folder that **contains** one or more repositories;
    +- the chat has no folder of its own.
    +
    +Then every git command is refused with **fatal: this chat's folder is not the top level of a git repository, and git in this chat cannot create or open another one.** The fix is to open the chat on the repository's top folder.
    +
    +## What Haruno can do
    +
    +| Kind of task | Commands |
    +|---|---|
    +| Look at the history and the changes | `status`, `log`, `show`, `diff`, `blame`, `grep`, `describe`, `shortlog`, `ls-files`, `ls-tree`, `cat-file`, `rev-parse`, `rev-list` |
    +| Branches and tags | `branch`, `tag`, `switch`, `checkout`, `merge`, `revert`, `cherry-pick` |
    +| Make local changes | `add`, `restore`, `commit`, `reset`, `stash`, `mv`, `rm`, `clean`, `apply` |
    +| Read settings | `config` (reading a value only), `remote` (reading remotes only), `worktree list`, `version` |
    +
    +A few are limited. `stash show` is not available, and Haruno uses `git diff stash@{0}` instead.
    +
    +A commit uses the name and email already set for that repository, or on your PC. Haruno reads them when the chat starts. Changing them during the chat does not change who the commits belong to.
    +
    +## What it cannot do
    +
    +- **Anything that needs a network.** `fetch`, `pull`, `push`, `clone` and `submodule` are refused with **fatal: this chat has no network, so git cannot reach a remote.** Sending commits to a remote is something you do yourself.
    +- **Start a new repository.** `git init` is refused. Haruno also cannot point git at another repository.
    +- **Interactive commands**, such as `rebase` and `bisect`. There is nobody at a keyboard to answer them.
    +- **Things that run other programs.** Repository hooks, aliases, editors, signing programs and external diff tools do not run. A command that depends on one behaves differently from your terminal.
    +
    +If git is missing for a chat, the chat starts without it. A git command then answers **git: this chat runs in an isolated session and git is not available here**.
    +
    +<Callout variant="info" title="Reading GitHub is a different thing">
    +Looking up an issue or a review on GitHub does not go through git. See [Reading GitHub](/windows/safety/reading-github/).
    +</Callout>
    +
    +<Callout variant="tip" title="What to tell a customer">
    +For everyday work, such as checking what changed and committing, git works in the chat. For anything that talks to a server, such as pushing, the customer does it themselves outside the chat.
    +</Callout>