Git Extended icon

Git Extended

Run Git commands

Overview

This node allows you to run various Git commands directly from n8n workflows. It is useful for automating version control tasks such as checking repository status, cloning repositories, committing changes, switching branches, and more. For example, you can use it to automatically pull the latest code before running a deployment or to check the status of a repository as part of a CI/CD pipeline.

The Status operation specifically runs git status on a given repository path, providing information about the current state of the working directory and staging area (e.g., modified files, untracked files).

Properties

Name Meaning
Repository Path Filesystem path where the Git command will be executed. For clone, this is the parent path.

Output

The output contains a JSON object with two main fields:

  • stdout: The trimmed standard output of the git status command, showing the repository's current status.
  • stderr: The trimmed standard error output, which may contain warnings or errors from Git.

Example output JSON:

{
  "stdout": "On branch main\nYour branch is up to date with 'origin/main'.\nnothing to commit, working tree clean",
  "stderr": ""
}

No binary data is produced by this operation.

Dependencies

  • Requires Git to be installed and accessible in the system environment where n8n runs.
  • No external API keys or credentials are needed for the Status operation.
  • The node executes shell commands using the system's Git CLI.

Troubleshooting

  • Common issues:

    • If the specified repository path does not exist or is not a Git repository, the command will fail.
    • Permissions issues may prevent Git commands from executing properly.
    • If Git is not installed or not in the system PATH, the node will throw an error.
  • Error messages:

    • "fatal: not a git repository (or any of the parent directories): .git" indicates the path is not a valid Git repo.
    • "command not found: git" means Git is not installed or not accessible.
  • Resolutions:

    • Verify the repository path is correct and points to a valid Git repository.
    • Ensure Git is installed and available in the environment running n8n.
    • Check file system permissions for the repository path.

Links and References

Discussion