# Code, dotfiles and trusted folders

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> Ringleader puts your code on a workstation, installs your dotfiles, and tells coding tools which folders to trust.


Ringleader puts your code on a workstation, installs your dotfiles, and tells coding tools
which folders to trust. The code comes from a Git repository or a folder on your computer.
You declare each of these once, on a workstation or a
[configuration layer](https://docs-stg.ringleader.dev/workstations/configuration/configuration-layers/),
so every rebuild starts with your code and your shell set up.

## Code sources

A code source puts code at a path on the workstation. Ringleader syncs the sources in the
order you declare them. A source is one of two kinds:

- A Git clone.
- A folder on the computer that runs the workstation, for a workstation on your own
  computer. Ringleader copies it again on every configuration pass and leaves out `.git`.

A Git source's `updatePolicy` says what happens after the first clone:

- `pinned`, the default, clones once and then leaves the folder alone.
- `latest` fast-forwards the clone on each configuration pass.

A private repository over SSH can use the SSH key you forward to the workstation, with no
more setup. A workstation without your forwarded key needs a Secret instead, such as one in
the cloud or one that runs a CI job. The Secret holds a deploy key for an SSH URL, or an
access token for an HTTPS URL. The source names that Secret in `credentialRef`.

Every source's path is a [trusted folder](#trusted-folders). A source whose repository has
a `devcontainer.json` can also run that container on the workstation, as
[Devcontainer workstations](https://docs-stg.ringleader.dev/workstations/packages-tools-settings/devcontainers/) describes.

## Trusted folders

Coding tools ask whether you trust the authors of the files in a folder before they work in
it. Ringleader answers for them, on a workstation that exists to work on those folders. The
trusted folders are every code source's path, and every path in `trustedFolders`. A
relative path is read from the login user's home folder.

Each tool uses the trusted folders its own way. Claude Code and Codex trust each trusted
folder, matched exactly.

<div class="callout callout-warning">
  <p class="callout-title">VS Code trust is off for every folder</p>
  <div class="callout-body">
    <code>vscode-web</code> and <code>vscode-server</code> turn their trust check off for every folder once there is
at least one trusted folder, unless you set those VS Code settings yourself.
  </div>
</div>


Claude Code, Codex and `vscode-web` get the trusted folders from their
[devtool](https://docs-stg.ringleader.dev/workstations/packages-tools-settings/devtools-tool-configuration/) alone.
`vscode-server` installs nothing on the workstation, so it gets them only when you declare
its [tool configuration](https://docs-stg.ringleader.dev/reference/tools/tool-configuration/vscode-server/).

## Dotfiles

Ringleader installs dotfiles two ways, and you can use both:

- The `dotfiles` setting maps a file in the login user's home folder, such as `.bashrc`, to
  lines to add to it. Ringleader writes those lines as a block it manages inside the file,
  and leaves the rest of the file alone. If something removes the block, Ringleader writes
  it again on the next pass.
- A dotfiles repository is your own repository of dotfiles, which Ringleader clones and
  installs with the repository's own install script. It suits a
  [personal layer](https://docs-stg.ringleader.dev/workstations/configuration/configuration-layers/#personal-layers),
  so it follows you to every workstation you own.

By default neither one blocks the workstation when it fails. The `dotfiles` setting never
does, and a dotfiles repository does only with `fatal: true`, as
[Step failures and retries](https://docs-stg.ringleader.dev/workstations/configuration/step-failures-retries/)
explains.

To set up your dotfiles repository and shell lines on every workstation you own, follow
[Bring your setup to every workstation](https://docs-stg.ringleader.dev/guides/bring-setup-every-workstation/).

## Dotfiles repository installation

Ringleader installs a dotfiles repository as the login user, so the checkout and every file
it writes belong to that user. It takes these steps:

1. It clones the repository into `~/.dotfiles`, or the `path` you set. With
   `updatePolicy: latest`, it fast-forwards an existing clone.
2. It runs an install script, with the checkout as its working folder: your `installScript`
   if you set one. Otherwise it runs the first of these that exists and can run:
   `install.sh`, `install`, `bootstrap.sh`, `bootstrap`, `setup.sh`, `setup`, then the same
   six under `script/`.
3. With no install script, it links every top-level entry whose name starts with `.` into
   your home folder, folders included, so `.config/` works. It skips every entry whose name
   starts with `.git`, apart from `.gitconfig`, which it links.

When it links, Ringleader skips anything that already exists at the destination. So it is
safe to run on every pass. Linking never replaces a file that the `dotfiles` setting, a
`files` entry or a tool configuration writes. Your own install script can replace any file,
though, and Ringleader then writes its `dotfiles` block back on the next pass.

A workstation has one dotfiles repository. A higher-priority layer replaces the whole
`dotfilesRepo` setting, the workstation's own included, as
[Layer merge order](https://docs-stg.ringleader.dev/workstations/configuration/configuration-layers/#layer-merge-order)
explains. A dotfiles checkout is not a trusted folder.

## Host keys for outbound SSH

To clone over SSH, the workstation must trust the Git server's host key. Add the server to
`sshKnownHosts`. Ringleader writes those keys into a block it manages in the login user's
`~/.ssh/known_hosts`, and leaves the rest of the file alone. An entry is either a bare
hostname, which Ringleader resolves from a built-in catalog, or a host with its `keys`. Use it
for a code source, a dotfiles repository, or SSH that a script runs.

Without an `sshKnownHosts` entry, a dotfiles repository with no `credentialRef` fails to clone,
with a message that names the host.

## Clone a repository onto a workstation

To put a repository on a workstation, list it under `spec.sources` with a `path`:

```yaml
spec:
  sources:
    - name: app
      path: /home/dev/app
      updatePolicy: latest
      git:
        url: https://github.com/acme/app.git
        ref: main
```

This example uses `/home/dev`, the home of a login user named `dev`. Use the home of your
workstation's login user.

For a private repository that your forwarded SSH key can't reach, add a `credentialRef` that
names the Secret with its token:

```yaml
spec:
  sources:
    - name: app
      path: /home/dev/app
      git:
        url: https://github.com/acme/app.git
        credentialRef:
          name: gh-token
          key: token
```

To clone with `git` yourself instead of `spec.sources`, from the workstation's shell, follow
[Give a workstation access to GitHub](https://docs-stg.ringleader.dev/guides/github-access/).

## Copy a folder from your computer

To copy a folder from your computer onto a workstation that runs there, give the source a
`local` path instead of `git`:

```yaml
spec:
  sources:
    - name: local-lib
      path: /home/dev/lib
      local:
        path: /host/checkout/lib
```

<div class="callout callout-warning">
  <p class="callout-title">Edits are overwritten</p>
  <div class="callout-body">
    Ringleader copies the folder again on every configuration pass, over the workstation&rsquo;s copy.
Make changes in the folder on your computer.
  </div>
</div>


## Trust another folder

To trust a folder that isn't a code source, list it in `spec.trustedFolders`:

```yaml
spec:
  trustedFolders:
    - /home/dev/scratch
```

## Trust a Git server's host key

To clone from a server that isn't in the built-in catalog, add its host key to
`spec.sshKnownHosts`:

```yaml
spec:
  sshKnownHosts:
    - host: git.internal
      keys: ["ssh-ed25519 AAAA..."]
```

## Next steps

- [Code sources](https://docs-stg.ringleader.dev/reference/resources/workstationconfig/#code-sources) and
  [Dotfiles repository](https://docs-stg.ringleader.dev/reference/resources/workstationconfig/#dotfiles-repository)
  list every field.
- [Scripts, files and services](https://docs-stg.ringleader.dev/workstations/packages-tools-settings/scripts-files-services/)
  covers the rest of a workstation's setup.

