Git Extended icon

Git Extended

Run Git commands

Overview

This node, named "Git Extended," allows users to run a wide range of Git commands directly within an n8n workflow. It supports many common Git operations such as listing branches, cloning repositories, committing changes, pushing and pulling from remotes, managing branches, applying patches, and more.

The node is useful for automating Git workflows without leaving the n8n environment. For example, it can be used to:

  • List all branches in a local repository.
  • Create or delete branches programmatically.
  • Commit staged changes with a custom message.
  • Clone a remote repository into a specified directory.
  • Push changes to a remote repository with optional authentication.
  • Apply patches from text or files.
  • Configure user identity for commits.

Practical scenarios include CI/CD pipelines, automated code deployment, synchronizing repositories, or integrating Git operations into larger automation workflows.

Properties

Name Meaning
Repository Path Filesystem path where the Git command will be executed. For clone, the repo is created here.
Skip Stdout Whether to ignore the command output to avoid maxBuffer errors (true/false).

Note: The above are the properties relevant to the Branches operation under the Default resource, as requested.

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.

For the Branches operation, the output JSON structure looks like:

{
  "stdout": "<list of branches>",
  "stderr": ""
}
  • stdout: A trimmed string listing the branches in the repository, as returned by git branch.
  • stderr: Any error messages produced by the Git command.

If Skip Stdout is set to true, the output JSON will be empty {} because the command output is ignored to prevent buffer overflow issues.

The node does not output binary data.

Dependencies

  • Requires Git to be installed and accessible on the system where n8n runs.
  • Uses Node.js child process execution to run Git commands.
  • May require an API key credential or username/password for authenticated operations (not applicable for the Branches operation).
  • No additional external services are required for the Branches operation.

Troubleshooting

  • Common Issues:

    • If the specified Repository Path does not exist or is not a Git repository, the command will fail.
    • Buffer overflow errors may occur if the command output is very large; enabling Skip Stdout can help mitigate this.
    • Permission issues when accessing the filesystem path can cause failures.
  • Error Messages:

    • "Unsupported operation branches": This would indicate a misconfiguration but should not happen since "branches" is supported.
    • Errors related to Git command execution will appear in the stderr field or as thrown exceptions.
  • Resolutions:

    • Ensure the Repository Path points to a valid Git repository.
    • Enable Skip Stdout if encountering maxBuffer errors.
    • Verify file system permissions for the path.
    • Confirm Git is installed and available in the system PATH.

Links and References

Discussion