Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Git repositories and credentials

Code as Usual deliberately separates the project’s repository definitions from each developer’s private credentials:

ItemOwnerWhat it controls
Project repositoryProjectURL, folder, default branch, whether it is required and the maximum authority an environment may request
Git credentialSigned-in userOne personal HTTPS username and token, limited to a host and optionally a repository path

The shared repository definition never contains a personal secret. A personal credential never becomes a project credential and is never visible to another member.

Where each setting lives

Repository definitions are under:

In the app: Projects → project title → Settings → Git

Personal credentials are under the account gear at the bottom of the main menu:

In the app: Account settings → Git credentials

This separation is intentional. Creating or managing a project never asks an administrator to decide whether a token will be shared. Tokens are always personal. The server fetches the list from the authenticated user’s ID; even a workspace administrator cannot read, replace or revoke another person’s token. An ordinary project member may inspect the project’s repository definitions, but cannot edit them.

Add a repository to a project

In the app: Projects → project title → Settings → Git → Project repositories

Who can do this: a project manager.

  1. Under Add repository, enter a human-readable Name.
  2. Enter the Folder in environment. A value such as backend creates the checkout at /workspace/repositories/backend.
  3. Enter the complete HTTPS repository URL.
  4. Enter the Default branch used for new environments.
  5. Choose Maximum authority:
    • Read only prevents an environment from receiving app-managed push authority for this repository.
    • Push allowed permits, but does not force, a developer to choose a matching push credential when creating an environment.
  6. Keep Required in new environments selected when every environment must include the repository. Clear it when developers may omit it.
  7. Select Add repository.

Expected result: the repository appears in the shared list. No clone is made automatically. New environments can select the definition during creation; an existing running environment can add it explicitly from its Git view.

Add a repository to an existing environment

In the app: Projects → project title → environment title → Git → Add repository

The environment must be running. The dialog offers the active repository definitions from the same project and your own matching Git credentials.

  1. Choose the Project repository definition.
  2. Review or change the Branch.
  3. Choose Read only or, when the project definition permits it, Push allowed.
  4. For a public read-only repository, keep No credential. Otherwise choose a matching personal credential.
  5. Select Add repository or press Enter.

A private repository still needs a personal credential when Read only is selected. A credential declared as push-capable may also be used for that read-only clone; the selected environment access remains read-only and Code as Usual removes the temporary clone credential afterward.

The clone runs as a repository-specific background operation. The environment stays running and its terminals remain usable. The Git view shows Adding…, then the normal repository status. A failed clone shows a safe explanation and can be retried from the same dialog with another branch, authority or credential.

The target is always the folder from the project definition under /workspace/repositories; this operation cannot overwrite another registered checkout. If the server process is interrupted after Git installed the working tree, Code as Usual verifies the existing origin, branch and commit and finishes the same receipt instead of cloning a duplicate.

The Git host must already be reachable through the running environment’s network policy. A host already used by another checkout is available. For a new host, add its HTTPS destination under Network access, update the environment, and then add the repository. This explicit order prevents a Git action from silently changing the environment’s network boundary.

Create your personal Git credential

In the app: Account settings → Git credentials

Who can do this: every signed-in user.

The saved credential belongs to your user account. It can be offered for an accessible project repository only when the host, optional path scope and declared authority match.

  1. Create a personal access token at your Git provider. Give it no more authority than you need.
  2. Enter a Name that you will recognize, for example GitHub read-only.
  3. Enter the provider’s required Git username.
  4. Under Repository URL on the intended host, enter a real HTTPS repository URL. Code as Usual uses it to establish the exact host, not to add that repository to the project or bind the credential to it. You can reuse the credential for other repositories on the same Git server.
  5. Optionally enter a Path scope such as team or team/project. Leave it empty to make the credential available to every matching repository on that Git server, subject to the permissions of the token itself.
  6. Choose Declared token authority. This declaration must match the real provider token; it cannot reduce an over-privileged token at the provider.
  7. Paste the Personal access token and select Add credential.

Before anything is saved, Code as Usual starts a disposable isolated check, contacts that exact repository through the same restricted network path used by an environment and asks Git for its remote references. It neither clones nor changes the repository. The token is installed through standard input in the disposable runtime, never in a host command line, and the runtime is removed when the check finishes.

Expected result: Verified appears beside the credential, followed by its name, username, host, scope and declared authority. The token itself is encrypted and is never shown again. If authentication, provider SSO, DNS, network access or TLS fails, the dialog names that category and the credential is not saved.

Test a saved credential again

In the app: Account settings → Git credentials → Test connection…

Enter one exact HTTPS repository URL that the credential should be able to read and select Test connection. This is useful after changing token permissions or organization authorization. The Verified/Test failed badge is the result of the current browser session; the provider remains authoritative and can revoke a token later.

If a protected environment cannot be created, first run this test against the same repository. Environment creation now distinguishes a rejected credential or provider SSO requirement from a missing branch, DNS failure, blocked network path and untrusted TLS certificate. Copy the complete visible message when asking an administrator for help; never send the token itself.

Host and path matching example

For a project repository at:

https://github.example.com/acme/backend.git
  • a credential for github.example.com with no path scope matches;
  • a credential scoped to acme matches;
  • a credential scoped to acme/backend matches;
  • a credential scoped to another-team does not appear as a choice.

Choose Git access when creating an environment

In the app: Projects → project title → Create environment → Project repositories

For every included repository:

  1. Review or change the Initial branch.
  2. Choose Authority in this environment.
  3. Choose one of My credential entries that matches the repository and authority.

For Read only, a public repository may use No credential. If a read-only credential is selected, it is used for the initial clone and then removed from the runtime.

For Push allowed, a matching push credential is required. Push authority remains available to processes inside that environment. This includes shell scripts, build tools and coding agents that the user starts there. Choose push only when that is the intended boundary.

Creating another terminal in the same environment does not create a new clone or a different authority boundary. Creating another environment creates a separate checkout and lets you choose another branch or lower authority.

Work with the checkout

In the app: Projects → project title → environment title

  • Files shows the repository under repositories.
  • Git shows local status and an optional remote comparison.
  • Terminals and Open in VS Code operate on the same real checkout.

Code as Usual intentionally leaves commit, pull, merge and push semantics to ordinary Git. For example:

cd /workspace/repositories/backend
git status
git switch -c feature/my-change
git add .
git commit
git push

The web Git view is an overview, not a second version-control implementation. Repository hooks, branch protection and the external Git provider remain authoritative.

Refresh rereads the checkout that already exists inside the environment; it does not fetch, pull, merge, commit or push. Perform those operations in a terminal or IDE, where the real branch, index, credential authority and command result remain visible. Code as Usual never runs host-side Git against a user-writable checkout.

Revoke a credential

In the app: Account settings → Git credentials → Revoke

Revoking prevents new environments from selecting the credential. It does not silently rewrite existing runtime files. If a provider token may be exposed or must stop working everywhere, revoke it at the Git provider as well, then stop or replace affected environments.

What transfers during handover

Repository branches, the index and working-tree files move with an accepted environment handover. The sender’s Git credentials do not. The recipient must select their own credential and authority before starting the received work.

Security boundary

The application does not run host-side Git against a user-writable checkout. App-assisted Git inspection runs inside the isolated environment with bounded arguments and output.