abhigyanpatwari/GitNexus · error · Error

Refusing group-writable auto-sync clone root: ${root}

Error message

Refusing group-writable auto-sync clone root: ${root}

What it means

Thrown by assertDirectoryOwnerAndPermissions (POSIX only) when the clone-root directory's permission mode has the group-write bit set (mode & 0o010) and group writing is not expected. A group-writable directory allows other members of the owning group to tamper with cloned repository content that auto-sync subsequently pulls and indexes, so the directory is rejected until the permission is tightened.

Source

Thrown at gitnexus/src/core/auto-sync/path-security.ts:279

  // POSIX uid/mode have no meaning on Windows, and this runs on every tick for
  // every project, so throwing here failed 100% of repos forever while `watch
  // status` still read `running`. Skip the ownership assertions rather than the
  // whole feature: the caller's other guards — dangerous-root rejection
  // (including the Windows system roots), symlink refusal, realpath containment
  // and the GitNexus-internal-root check — all still apply, and managed git runs
  // with `core.hooksPath` pinned to the null device.
  if (process.platform === 'win32') return;
  if (typeof process.getuid === 'function' && stat.uid !== process.getuid()) {
    throw new Error(`auto-sync clone root is owned by uid ${stat.uid}, not current process uid`);
  }
  const mode = stat.mode & 0o777;
  const groupWritable = (mode & 0o020) !== 0;
  const worldWritable = (mode & 0o002) !== 0;
  if (worldWritable) {
    throw new Error(`Refusing world-writable auto-sync clone root: ${root}`);
  }
  if (groupWritable) {
    throw new Error(`Refusing group-writable auto-sync clone root: ${root}`);
  }
}

function assertContainedOrSame(root: string, child: string, message: string): void {
  const rel = path.relative(root, child);
  if (rel.startsWith('..') || path.isAbsolute(rel)) throw new Error(message);
}

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. chmod g-w <root> to clear the group-write bit (e.g. chmod 755)
  2. Apply chmod -R g-w if the permissive mode was inherited by existing cloned repos
  3. Choose a clone root owned solely by the watcher user rather than a shared-group directory
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at gitnexus/src/core/auto-sync/path-security.ts:279 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-09-08). Data as JSON: /api/errors/77837d433c128a3b. Report an issue: GitHub.