Git Extended icon

Git Extended

Run Git commands

Overview

The node "Git Extended" allows running various Git commands directly from n8n workflows. It supports a wide range of Git operations such as cloning repositories, committing changes, switching branches, merging branches, and more. This node is useful for automating Git-related tasks within CI/CD pipelines, deployment workflows, or any automation that requires interaction with Git repositories.

For the Merge operation specifically, the node merges a specified branch or commit into the current branch in a local Git repository. This is beneficial when you want to automate integration of feature branches, bug fixes, or updates from other branches without manual intervention.

Example use case: Automatically merge a development branch into the main branch after successful testing, as part of a deployment pipeline.

Properties

Name Meaning
Repository Path Filesystem path where the Git command will be executed. For clone, the repo is created here.
Target Branch or commit to merge into the current branch.
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) of the executed Git command, unless Skip Stdout is enabled. In that case, the output JSON will be empty.

Output example when not skipping stdout:

{
  "stdout": "<trimmed git merge command output>",
  "stderr": "<trimmed git merge command 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.
  • The node executes Git commands via the command line interface.
  • 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 merge operation.

Troubleshooting

  • Common issues:

    • Incorrect Repository Path: If the path does not point to a valid Git repository, the merge command will fail.
    • Merge conflicts: The Git merge command may fail if there are conflicts that require manual resolution.
    • Buffer overflow errors: Large command outputs can cause maxBuffer errors; enable Skip Stdout to mitigate.
  • Error messages:

    • "Unsupported operation merge": Indicates the operation name was not recognized; ensure the operation parameter is set correctly.
    • "Command failed with exit code X": Generic failure of the Git command; check the stderr output for details.
    • "Failed to parse the repository URL": Relevant for clone operation with authentication; ensure the URL is correct.
  • Resolutions:

    • Verify the repository path points to a valid Git repo.
    • Resolve merge conflicts manually or adjust workflow logic to handle them.
    • Enable Skip Stdout to avoid buffer size issues.
    • Ensure proper authentication credentials are configured if needed.

Links and References

Discussion