Git Extended icon

Git Extended

Run Git commands

Overview

The node "Git Extended" allows users to run various Git commands directly from n8n workflows. It supports common Git operations such as cloning repositories, adding files, committing changes, switching branches, merging branches, pulling and pushing updates, viewing logs, and checking repository status.

This node is beneficial in automation scenarios where you want to integrate version control actions into your workflow without leaving the n8n environment. For example, it can be used to automate deployment pipelines by committing and pushing code changes, or to synchronize local repositories with remote ones automatically.

Specifically, the Merge operation merges a specified branch or commit into the current branch of a Git repository located at a given filesystem path.

Properties

Name Meaning
Repository Path Filesystem path to run the Git command from. For clone, the repository will be created inside this path.
Target Branch or commit to operate on. For the Merge operation, this is the branch or commit to merge into the current branch.

Output

The node outputs an array of items, each containing a json object with the following fields:

  • stdout: The standard output from the executed Git command, trimmed of whitespace.
  • stderr: The standard error output from the Git command, trimmed of whitespace.

This output provides the raw textual result of the Git merge command, which can include success messages, conflict information, or error details.

The node does not output binary data.

Dependencies

  • Requires Git to be installed and accessible via the command line on the machine where n8n is running.
  • No external API keys or services are needed.
  • The node executes Git commands using the system shell, so appropriate permissions to access the specified repository paths are necessary.

Troubleshooting

  • Common issues:

    • Incorrect repository path: Ensure the Repository Path points to a valid Git repository.
    • Merge conflicts: If the merge results in conflicts, the stderr output will contain conflict details. Manual resolution may be required.
    • Permission errors: The user running n8n must have read/write permissions for the repository directory.
    • Invalid target: Specifying a non-existent branch or commit as Target will cause Git to error.
  • Error messages:

    • "Unsupported operation": This indicates an invalid operation was selected; ensure "merge" is chosen.
    • Git-specific errors (e.g., "fatal: Not a git repository"): Check that the repository path is correct and initialized.
    • Command execution errors are captured and returned in the output's stderr field or thrown as node errors if not continuing on fail.

Links and References

Discussion