git-client is a lightweight, Promise-based Git client for Node.js, currently at stable version 1.11.1. It distinguishes itself by directly executing the system's `git` binary, offering a robust and comprehensive interface to all Git operations rather than reimplementing them in JavaScript. The library provides a clean, Promise-based API for command execution, supporting automatic method generation for Git commands, flexible option handling (both short and long format), and a 'spawn mode' for streaming operations. It includes full TypeScript support and has minimal dependencies. Recent releases indicate an active development cadence, with improvements and fixes rolled out every few weeks to months. It requires Node.js 16.x or higher and the `git` command-line tool to be installed and accessible in the system PATH.
npm install git-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic Git command execution using the default function and named methods, and includes a check for Git availability.
Prefix special options with `$` (e.g., change `spawn: true` to `$spawn: true`). Refer to the documentation for the complete list of special options.
Ensure `git` is installed and its executable is discoverable via your system's PATH environment variable. Verify by running `git --version` in your terminal.
Upgrade your Node.js environment to version 16.x or newer.
Always sanitize or validate user-provided input before passing it as arguments to `git` commands. Avoid using `$shell: true` with untrusted input.
Install Git on your system and ensure its directory is included in your system's PATH environment variable. Verify by running `git --version` in your terminal.
Use the ES module import syntax: `import git from 'git-client';`.
Ensure the command exists in Git's CLI and that you are calling it correctly. For direct `git('command', ...)` usage, check the command string. For named methods (`git.commandName`), ensure correct casing (e.g., `revParse` not `RevParse`).No dependency data recorded yet.