Git Extended icon

Git Extended

Run Git commands

Overview

This node, named "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, creating branches, committing changes, pushing and pulling from remotes, managing tags, and more.

The Create Branch operation specifically creates a new branch in a local Git repository at a specified filesystem path.

Common scenarios:

  • Automating Git workflows in CI/CD pipelines.
  • Creating feature branches programmatically before running tests or deployments.
  • Managing multiple repositories or branches without manual command line interaction.
  • Integrating Git operations into broader automation workflows.

Practical example:

You want to create a new branch called feature-x in your local repository located at /home/user/myrepo. This node can be configured to run the equivalent of git -C "/home/user/myrepo" branch feature-x, automating branch creation as part of a larger workflow.


Properties

Name Meaning
Repository Path Filesystem path to run the Git command from. For clone, the repository will be created inside this path.
Branch Name Name of the branch to create.
Skip Stdout Whether to ignore command output to avoid maxBuffer errors (true/false).

Output

The node outputs JSON data with the following structure:

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

If Skip Stdout is enabled, the output JSON will be empty ({}) to prevent buffer overflow issues when large outputs are expected.

No binary data output is produced by this operation.

Example output JSON when creating a branch successfully (if not skipping stdout):

{
  "stdout": "",
  "stderr": ""
}

(Note: git branch <branchName> typically produces no output on success.)


Dependencies

  • Requires Git installed and accessible in the system's PATH where n8n runs.
  • Uses Node.js child process execution to run Git commands.
  • Requires an API key credential for authentication if performing operations that need authentication (not applicable for local branch creation).
  • No external APIs are called for the Create Branch operation.

Troubleshooting

  • Common issues:

    • Invalid or non-existent repository path: The command will fail if the specified path does not contain a Git repository.
    • Branch name conflicts: Trying to create a branch that already exists will cause Git to return an error.
    • Permission issues: Insufficient permissions to access the repository directory may cause failures.
  • Error messages:

    • "Unsupported operation createBranch": Indicates the operation name was not recognized; ensure the operation parameter is set correctly.
    • "Command failed with exit code X": Generic failure from Git command; check the branch name validity and repository path.
    • "Failed to parse the repository URL": Not relevant for Create Branch but may appear in other operations involving URLs.
  • Resolutions:

    • Verify the repository path points to a valid Git repository.
    • Ensure the branch name is unique and valid according to Git naming rules.
    • Check file system permissions for the user running n8n.
    • Enable Skip Stdout if encountering buffer size errors due to large command outputs.

Links and References

Discussion