acct
Install

ACCT · V0.2

Command reference

The npm package is acct-sh, and acct is the command you run to manage your folder-based GitHub identity.

How a folder picks its identity.

  1. 01

    CLI --profile

    An explicit profile applies to gh, status, and exec for the current process, while Git HTTPS still follows the directory.

  2. 02

    Nearest .acct

    acct searches upward from the Git worktree root, or the current directory outside Git, and ignores markers below the repository root. An empty profile explicitly unbinds the repository.

  3. 03

    Longest binding

    The longest canonical directory binding wins, with strict mode refusing conflicts between a worktree and its common Git directory.

  4. 04

    Unbound

    When no profile applies, strict mode blocks managed operations that require an identity.

Use acct in your IDE or editor.

Git identity and managed authentication follow your folder when the IDE uses the Git installation where you configured acct. Zed’s Git integration uses Git for repository operations, while Vim and Neovim can use the same setup through shell commands or Git plugins that invoke that Git installation.

In JetBrains IDEs, select your Git executable and enable Use credential helper under Settings → Version Control → Git so HTTPS operations use acct’s helper.

JetBrains Git settings

Zed disables Git hooks and credential helpers in untrusted projects, so the project must be trusted for acct’s managed Git operations.

An IDE’s own GitHub account and pull-request integration stay separate. For gh commands in an IDE task that does not load your shell hook, use acct exec to resolve the folder’s profile explicitly.

acct status
acct exec gh pr list

Start

Install the package, then run acct for guided setup.

acct

acct [--help] [--version]

Running acct in a terminal opens guided setup, while non-interactive processes receive the tip sheet; --help lists every command.

npm install -g acct-sh
acct
acct --help

acct init

acct init --id <id> --user <githubUser> --email <email> --name <name> [options]

Run without flags for guided setup, or provide the profile fields to create a profile, bind a directory tree, and install identity includes and global chaining hooks non-interactively.

acct init \
  --id work \
  --user your-work-user \
  --email you@company.com \
  --name "Your Name" \
  --bind ~/Work
--id <id>required
Profile id, e.g. work or personal.
--user <githubUser>required
GitHub username for this profile.
--email <email>required
Commit email (user.email).
--name <name>required
Commit name (user.name).
--host <host>
Use this GitHub host, which defaults to github.com.
--protocol <https|ssh>
Choose the preferred clone protocol, which defaults to https.
--bind <dir>
Bind this directory tree, or use the current directory when omitted.
--import-gh
Optionally seed the OS keychain from gh auth token --user; HTTPS and acct exec already follow gh for that user.
--global-hooks
Compatibility flag: installation already uses global chaining hooks by default.
--force
Compatibility flag: existing hooks are chained instead of overwritten.
  • New profiles start in strict enforce mode.
  • After init, persist the shell hook in your startup file. Bash refreshes at the next prompt; use acct exec or the gh wrapper for cd followed immediately by gh.

Profiles

A profile is one GitHub user, git identity, and credential set.

acct profile add

acct profile add --id <id> --user <githubUser> --email <email> --name <name> [options]

Create a profile without binding a folder, then connect it to a directory with acct bind.

acct profile add \
  --id personal \
  --user you-home \
  --email you@home \
  --name "Your Name"
--id <id>required
Profile id.
--user <githubUser>required
GitHub username.
--email <email>required
Commit email.
--name <name>required
Commit name.
--host <host>
Use this GitHub host, which defaults to github.com.
--protocol <https|ssh>
Choose the preferred protocol, which defaults to https.
--import-gh
Import a token from gh into the OS keychain.

acct profile list

acct profile list

Print every profile as id, user@host, email, and protocol.

acct profile list

acct profile show

acct profile show <id>

Print one profile as JSON with its token omitted.

acct profile show work

acct profile remove

acct profile remove <id>

Remove a profile after unbinding its directories. Secrets and SSH keys shared by other profiles are preserved.

acct profile remove work

acct profile token

acct profile token <id> (--import-gh | --stdin)

Store a token in the OS keychain. One of --import-gh or --stdin is required.

acct profile token work --import-gh
printf '%s' "$PAT" | acct profile token work --stdin
--import-gh
Import from gh auth token --user and keep following gh on refresh.
--stdin
Read a personal access token from stdin and set followGh to false so gh will not overwrite it.
  • Default path: HTTPS and acct exec follow gh auth token --user. After gh auth refresh you usually do not need --import-gh again.
  • Use --stdin for a dedicated PAT that must not track gh.

acct profile ssh-key

acct profile ssh-key <id> (--generate | --path <path>) [--protocol https|ssh]

Generate an ed25519 key for the profile, or attach an existing private key. The scoped HTTPS helper stays installed for SSH profiles too.

acct profile ssh-key work --generate
acct profile ssh-key work --path ~/.ssh/id_work
--generate
Create an ed25519 key and select SSH as the preferred protocol.
--path <path>
Attach an existing private key.
--protocol <https|ssh>
Set the preferred protocol; generating a key defaults to ssh when this is omitted.

Trees

Longest matching bound path wins. Leave the tree and that account stops applying.

acct bind

acct bind <dir> <profileId> [--enforce strict|warn|off]

Map a canonical directory tree to a profile. Bind a repository root or a parent tree; a subdirectory inside a repository is rejected. Installed identity includes are refreshed automatically.

acct bind ~/Personal personal
--enforce <mode>
Override enforce for this binding only: strict, warn, or off.

acct rebind

acct rebind <old> <new>

Move a binding and its nested binding subtree to a new canonical directory. Doctor reports missing or moved paths.

acct rebind ~/OldWork ~/Work

acct local set

acct local set [profileId] [--unbound]

Set the repository-root .acct marker and matching local Git identity include. An empty profile explicitly unbinds the repository. A marker below the root is ignored and diagnosed.

acct local set work
acct local set --unbound
--unbound
Explicitly unbind this repository, even inside a bound parent tree.

acct local clear

acct local clear

Remove the root-local marker and only acct's local identity include, returning to directory binding resolution.

acct local clear

acct unbind

acct unbind <dir>

Remove a directory’s profile binding while keeping the profile itself.

acct unbind ~/Downloads

Inspect

When something feels off, run these before changing config.

acct status

acct status [--profile <id>]

Show how the current directory resolves, including its binding, profile, identity, token presence, and authenticated account. When errors are found, explain the problem and suggested commands, indicate whether commit or push can proceed, and exit with code 1.

acct status
--profile <id>
Use this profile for the gh account while Git HTTPS continues to follow the directory binding or .acct marker.
  • Git authentication ignores ambient ACCT_PROFILE and prints a warning if it disagrees with the current directory.

acct whoami

acct whoami [--profile <id>]

Print expected GitHub user, actual login, and commit email. Exit codes: 0 for a match, 1 for a mismatch, 2 when the principal is unknown or the directory is unbound.

acct whoami
--profile <id>
Explicit profile for the gh plane.

acct doctor

acct doctor [--online]

Inspect helper order, hook coverage, stale shims, missing bindings, tokens, and keyring availability. The default offline check makes no API calls and does not persist token values from gh, although first access may migrate existing plaintext secrets.

acct doctor
acct doctor --online
--online
Call gh api to verify ambient GH_TOKEN against the cwd profile.

acct ssh-test

acct ssh-test <id>

Test SSH auth for a profile against github.com using that profile's key.

acct ssh-test work

Run

These commands supply GH_TOKEN for gh, while Git HTTPS continues to follow the directory binding.

acct exec

acct exec [--profile <id>] [--allow-cross-profile] <command...>

Run a command with the profile’s GH_TOKEN while Git HTTPS follows the directory binding or .acct marker. Commands that mutate global gh authentication, including gh auth switch, login, and token, are refused.

acct exec gh pr list
acct exec --profile work --allow-cross-profile gh api user
--profile <id>
Supply this profile’s token for gh while leaving the Git credential helper’s directory resolution in place.
--allow-cross-profile
Required when --profile differs from the cwd binding.

acct clone

acct clone <url> [git-clone-args...] [--profile <id>]

Clone with the selected profile environment. Git HTTPS credentials still follow the directory binding, not GH_TOKEN. Unknown profiles and strict worktree conflicts are refused.

acct clone https://github.com/org/repo.git
--profile <id>
Supply GH_TOKEN for helpers that honor it while Git continues to use the directory binding.

Enforce

Choose whether identity mismatches block an operation, produce a warning, or receive no enforcement, with local settings taking precedence.

acct enforce

acct enforce <strict|warn|off|on>

Set the default enforcement mode, using on as an alias for strict, or override a specific binding with acct bind --enforce.

acct enforce strict
  • In strict, a missing profile token or mismatched gh principal blocks push.
  • Commits use the name and email selected by Git’s conditional includes, while unmanaged gh commands can still use another account.

acct install

acct install [--repo] [--global] [--force]

Wire scoped Git identity and global v3 chaining hooks. Use --repo for a repository with a local hooksPath override; its previous local path is baked into separate repository shims.

acct install
--repo
Install per-repository hooks that chain the previous local hooksPath.
--global
Compatibility flag: installation already uses global chaining hooks by default.
--force
Compatibility flag: existing hooks are chained, not overwritten.

acct uninstall

acct uninstall [--restore-backup]

Remove managed includes and restore recorded hook paths only where acct owns the shims. Per-repository shim directories are removed. Existing OS credential helpers can still answer for GitHub; review the uninstall warning.

acct uninstall --restore-backup
--restore-backup
Restore the pre-acct gitconfig backup if one exists.

Shell

The hook resolves the profile from the current directory on each prompt after stripping any previously exported ACCT_PROFILE.

acct hook

acct hook <bash|zsh|fish|powershell>

Print a hook to load from your shell startup file so changing directories refreshes the profile environment or clears it outside bound folders.

eval "$(acct hook zsh)"
eval "$(acct hook bash)"
acct hook fish | source
acct hook powershell | Out-String | Invoke-Expression

acct shell-env

acct shell-env [--powershell | --fish]

Print environment exports for the current directory’s profile, which the shell hook normally handles for you.

acct shell-env
--powershell
Emit PowerShell syntax.
--fish
Emit native Fish syntax.

acct wrap-install

acct wrap-install

Install optional PATH shims that invoke gh as acct exec gh, then add the wrap-path export to your shell.

acct wrap-install
eval "$(acct wrap-path)"

acct wrap-path

acct wrap-path [--powershell | --fish]

Print the PATH export for wrapper shims, installing them first if they are missing.

eval "$(acct wrap-path)"
--powershell
Emit PowerShell syntax.
--fish
Emit native Fish syntax.

Internal

Git hooks call these commands automatically; run them by hand only when debugging their behavior.

acct hook-run

acct hook-run <pre-commit|pre-merge-commit|pre-push> [remote] [url]

Pre-commit and pre-merge-commit check effective identity. Pre-push checks every outgoing recorded identity and the actual remote authentication. Post-commit only chains existing hooks; it has no hook-run entry.

acct hook-run pre-push

Files and environment variables

Settings live in config.yaml, while tokens stay in your OS keychain or the explicitly selected file backend.

ACCT_FOLLOW_GH
Set 0 / false / off to stop following gh auth token --user. File backend already does not follow gh unless you set 1.
ACCT_SECRET_BACKEND
Set file on CI or headless hosts without a keyring to store plaintext secrets.json in the config directory with mode 0600.
ACCT_CONFIG_DIR
Override the config directory, which defaults to ~/.config/acct, %APPDATA%\acct on Windows, or $XDG_CONFIG_HOME/acct.
ACCT_PROFILE
The shell hook exports this profile id as a status hint, while the credential helper and hooks resolve from directory bindings or the repository-root .acct marker.
ACCT_SKIP_POSTINSTALL
Skip the npm postinstall tip sheet, which is also suppressed automatically in CI.
ACCT_NODE_PATH
Override the Node binary recorded in Git hooks, which otherwise use process.execPath rather than searching PATH.
ACCT_DEBUG
Print sanitized debug lines to stderr with token values replaced by [REDACTED].