Git Extended icon

Git Extended

Run Git commands

Overview

The node "Git Extended" allows users to run various Git commands directly within an n8n workflow. It supports a wide range of Git operations such as cloning repositories, committing changes, pushing and pulling branches, managing branches and tags, applying patches, and more.

For the Commit operation specifically, the node stages all changes in the specified repository path and creates a commit with the provided commit message if there are any changes to commit. This is useful for automating version control workflows, such as committing changes made by other nodes or scripts during an automated process.

Practical examples:

  • Automatically commit changes after generating or modifying files in a workflow.
  • Batch commit multiple changes in a repository without manual intervention.
  • Integrate Git commits into CI/CD pipelines managed by n8n.

Properties

Name Meaning
Repository Path Filesystem path where the Git command will be executed. For commit, this is the repo folder.
Commit Message The message to use for the commit. This is required for the commit operation.
Skip Stdout Whether to ignore the command output (stdout) to avoid buffer overflow errors. Defaults to false.

Output

The node outputs an array with one item per input item. Each output item contains a json object with the following fields:

  • stdout: The trimmed standard output from the Git command execution (unless Skip Stdout is true).
  • stderr: The trimmed standard error output from the Git command execution (unless Skip Stdout is true).

If Skip Stdout is enabled, the output JSON will be empty {} since command output is ignored.

In case of no changes to commit or no staged changes, the output will contain the corresponding echo message in stdout.

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 utilities to execute Git commands.
  • Requires an API key credential for authentication when performing operations that need it (e.g., clone, push, pull), but for commit operation no authentication is needed.
  • No additional external services are required for the commit operation.

Troubleshooting

  • Common issues:

    • If the repository path is incorrect or not a valid Git repository, the command will fail.
    • If there are no changes to commit, the node returns a message indicating so.
    • Buffer overflow errors can occur if the command output is very large; enabling Skip Stdout can help mitigate this.
  • Error messages:

    • "Unsupported operation commit": Indicates the operation name was not recognized; ensure the operation parameter is set correctly.
    • "No changes to commit": Means there were no modifications detected in the repository.
    • "No staged changes to commit": Means changes exist but none are staged; the node automatically stages all changes before committing.
    • Errors related to file permissions or invalid paths should be resolved by verifying the repository path and user permissions.

Links and References

Discussion