Git Extended icon

Git Extended

Run Git commands

Overview

This node, named "Git Extended," allows users to run a variety of Git commands directly within an n8n workflow. It supports many common Git operations such as cloning repositories, committing changes, managing branches, pulling and pushing updates, reverting commits, and more.

The Revert operation specifically enables users to revert a commit by its hash, effectively undoing the changes introduced by that commit without creating a new commit message (using the --no-edit flag).

Practical Use Cases

  • Automating repository maintenance tasks like reverting problematic commits.
  • Integrating Git version control actions into CI/CD pipelines.
  • Managing branches and commits programmatically in response to external triggers.
  • Quickly rolling back changes in a repository from within an automated workflow.

Properties

Name Meaning
Repository Path Filesystem path where the Git command will be executed. For clone, the repo is created here.
Commit ID The hash of the commit to revert. Required for revert operation.
Skip Stdout Whether to ignore the command output to avoid maxBuffer errors (true/false).

Output

The node outputs JSON data containing the standard output (stdout) and standard error (stderr) strings resulting from running the Git command, unless Skip Stdout is enabled. In that case, the output JSON will be empty.

Example output structure when not skipping stdout:

{
  "stdout": "<trimmed command output>",
  "stderr": "<trimmed error output>"
}

If Skip Stdout is true, the output JSON will be {}.

No binary data output is produced by this node.

Dependencies

  • Requires Git to be installed and accessible on the system where n8n runs.
  • Uses Node.js child process execution to run Git commands.
  • Requires an API key credential for authentication if operations like clone, push, or pull are used with authentication.
  • No additional external services are required for the revert operation.

Troubleshooting

  • Missing Commit ID: The revert operation requires a valid commit hash. If omitted, the node throws an error: "Commit ID is required."
  • Invalid Repository Path: Ensure the Repository Path points to a valid Git repository; otherwise, Git commands will fail.
  • MaxBuffer Errors: Large command outputs may cause buffer overflow errors. Enable Skip Stdout to avoid these by ignoring command output.
  • Permission Issues: Running Git commands may require appropriate filesystem permissions.
  • Git Not Installed: The node depends on the Git CLI being installed and available in the system PATH.

Links and References

Discussion