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 common Git operations such as cloning repositories, checking out branches or commits, switching branches, merging branches, adding files, committing changes, pushing and pulling from remotes, initializing repositories, viewing logs, and checking status.

This node is beneficial in automation scenarios where version control actions need to be integrated into workflows, such as:

  • Automatically cloning a repository before running build or deployment steps.
  • Switching branches or checking out specific commits as part of CI/CD pipelines.
  • Committing and pushing changes made during automated processes.
  • Merging branches programmatically after successful tests.

For example, you could use this node to clone a repository, switch to a feature branch, and then pull the latest changes before triggering a build.

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. Used for operations: switch, checkout, merge.

Output

The node outputs JSON data containing the results of the executed Git command:

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

If the command fails and the node is set to continue on failure, the output will contain an error field with the error message.

No binary data output is produced by this node.

Example output JSON:

{
  "stdout": "Switched to branch 'feature-branch'",
  "stderr": ""
}

Dependencies

  • Requires Git to be installed and accessible via the command line on the machine where n8n runs.
  • No external API keys or services are needed.
  • The node executes shell commands using the system's Git executable.

Troubleshooting

  • Common issues:

    • Incorrect repository path: Ensure the Repository Path points to a valid Git repository directory (except for clone operation).
    • Invalid branch or commit name in Target: Verify that the specified branch or commit exists.
    • Permissions errors: The user running n8n must have appropriate filesystem permissions.
    • Git not installed or not in PATH: The node relies on the git CLI being available.
  • Error messages:

    • "Unsupported operation <operation>": This indicates an invalid operation was selected; choose one of the supported operations.
    • Git command errors will appear in the stderr output. Review these messages for details like merge conflicts or authentication failures.
    • If the node throws an error and does not continue, check the error message for clues about missing parameters or invalid inputs.

Links and References

Discussion