Skip to content

LoserFox/dsh-git-identity

70Last commit Aug 13, 2026

dsh-git-identity DSH plugin

This plugin ensures that every git commit made within a DSH agent session uses the correct author identity. It parses the identity from the environment (gh CLI, GIT_AUTHOR_* env vars, git config --global) and injects it into GIT_AUTHOR_* and GIT_COMMITTER_* env vars, which take precedence over git config. It also syncs back to git config --global when missing or incorrect.

How to install the dsh-git-identity DSH plugin

dsh plugin --profile web add /path/to/dsh-git-identity

Copying does not run this command. Review the repository and version before installing the dsh-git-identity DSH plugin.

dsh-git-identity DSH plugin data source

dsh-git-identity DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-git-identity DSH plugin can do

  • Automatically resolves git identity from multiple sources: plugin config, gh CLI login, GIT_AUTHOR_* env vars, and git config --global.
  • Injects identity into GIT_AUTHOR_* and GIT_COMMITTER_* environment variables, ensuring all subprocess git commits use the correct author.
  • Idempotently syncs identity back to git config --global when the global config is missing or incorrect.
  • Zero-dependency, pure ESM module; no build step required for development.

Where the dsh-git-identity DSH plugin fits

  • Prevent incorrect git author in DSH sessions after a session previously overrode user.name/user.email.
  • Maintain consistent git authorship across multiple profiles (web, headless) in a DSH environment.
  • Automatically use the GitHub CLI login identity for commits, avoiding manual configuration.
  • Ensure git commits from any subprocess inside DSH always reflect the intended user identity.

Who the dsh-git-identity DSH plugin is for

  • DSH users who perform git operations inside agent sessions.
  • Developers working in shared DSH environments where git author identity needs to be managed.

dsh-git-identity DSH plugin limitations

  • Requires restarting the DSH profile after installation (profile bundle changes do not support HMR).
  • If no identity can be resolved from any source, the plugin only warns and does not inject any identity.
  • Relies on DSH's subprocess layer to pass environment variables to bash child processes (may not work if subprocess is bypassed).

dsh-git-identity DSH plugin: from the repository README

Quoted from the LoserFox/dsh-git-identity README, the upstream source of the dsh-git-identity DSH plugin. Copyright remains with the original authors.

DSH **profile bundle**(0812+ 的官方插件系统):让 DSH 内产生的所有 git 提交使用 环境自身的作者身份。优先读取 gh CLI 的登录账号(name 取 login,email 取 GitHub noreply 地址 `<id>+<login>@users.noreply.github.com`),其次启动环境的 `GIT_AUTHOR_*`、`git config --global` 兜底。 ## 为什么需要它 DSH 的 agent 会话通过 bash 工具执行 `git commit`。历史上一旦某个会话显式 `-c user.name="DSH Agent"` 或改掉了 git 配置,后续提交就会带着错误的作者。 本插件在加载时把解析到的身份写入 `GIT_AUTHOR_*` / `GIT_COMMITTER_*` 四个环境变量, DSH 的 subprocess 层会把 `process.env`(剔除凭据)传给每个 bash 子进程,而 git 的 环境变量优先级高于一切 git config——所以 DSH 内任何路径发起的提交都必然使用该身份。 同时幂等同步回 `git config --global`,让插件进程外的普通终端提交也保持一致 (仅当 global 配置缺失或被改错时写回)。 ## 安装(0812 profile bundle 系统) ```sh # 从本仓库 checkout 安装到 profile(web / headless 等),bundle 声明自动加入组合层 dsh plugin --profile web add /path/to/dsh-git-identity dsh plugin --profile headless add /path/to/dsh-git-identity # 验证 dsh --profile web --dump-config | grep git-identity ``` 安装后需重启目标 profile 的 DSH 进程(组合层变更不参与 HMR 热更新)。 ## 身份解析优先级 1. 插件配置 `{ name, email }`(显式钉死,最稳;未登录 gh 时可在此配置) 2. gh CLI 登录账号(`gh api user`) 3. 启动环境的 `GIT_AUTHOR_NAME` / `GIT_AUTHOR_EMAIL` 4. `git config --global user.name` / `user.email` 兜底 全部解析不到时只告警、不注入,绝不凭空编造身份。 ## 配置 ```yaml # 在 bundle 的 patch 里给行加 config(可选;不配置则按上述优先级自动解析) - insert:

Read the full READMEThe repository declares no license. Check with the authors before using it.

dsh-git-identity DSH plugin questions

How do I install the git-identity plugin?

Clone the repository locally, then run `dsh plugin --profile <profile> add /path/to/dsh-git-identity`. For example, to add it to the web profile: `dsh plugin --profile web add /path/to/dsh-git-identity`. After installation, restart the DSH process for that profile.

Does the plugin work with headless profiles?

Yes, you can install it on any profile (web, headless, etc.) by specifying the profile name in the install command. The plugin will then manage git identity for all git commits within that profile's sessions.

What happens if I don't have a GitHub CLI login?

If gh CLI is not logged in, the plugin falls back to the environment variables `GIT_AUTHOR_NAME` and `GIT_AUTHOR_EMAIL`, then to `git config --global user.name` and `user.email`. If none of these are set, it will warn and not inject any identity, so commits may use a default system identity.

Can I manually set a specific name and email in the plugin config?

Yes, you can configure the plugin with explicit `name` and `email` in the bundle's patch file. This will take the highest priority and override all other sources. See the README's configuration section for an example.

Do I need to restart DSH after installing or updating the plugin?

Yes, profile bundle changes do not support hot reload (HMR). You must restart the DSH process for the profile where the plugin was added. You can verify the plugin is loaded by running `dsh --profile <profile> --dump-config | grep git-identity`.