GitLab Extended icon

GitLab Extended

Extended GitLab node

Overview

The node "GitLab Extended" provides extended integration with GitLab, allowing users to manage various GitLab resources such as branches, files, tags, releases, groups, projects, issues, merge requests, pipelines, and raw API calls. Specifically for the File - Create operation, this node enables creating a new file in a GitLab repository by committing it to a specified branch with a commit message.

This is useful in scenarios where you want to automate adding new files to your GitLab repositories directly from workflows, such as:

  • Automatically generating configuration or documentation files during CI/CD processes.
  • Uploading reports or logs generated by other automation steps.
  • Creating template files in new feature branches programmatically.

Example: You can create a new source code file src/index.ts on the main branch with specific content and a commit message describing the change.


Properties

Name Meaning
Authentication Choose between using saved credentials ("Credential") or providing custom connection details ("Custom") such as server URL and access token.
GitLab Server Base URL of your GitLab instance (e.g., https://gitlab.com). Only shown if "Custom" authentication is selected.
Access Token Personal access token with API permissions for authentication. Only shown if "Custom" authentication is selected.
Project Owner Namespace or owner of the project. Ignored if "Project ID" is set. Only shown if "Custom" authentication is selected.
Project Name Project slug or name. Ignored if "Project ID" is set. Only shown if "Custom" authentication is selected.
Project ID Numeric project ID. Takes precedence over owner and name if provided. Only shown if "Custom" authentication is selected.
Ref Existing branch or commit SHA to create the new branch from (default: main). Required for some operations but not specifically for file creation.
Path Path to the file in the repository, e.g., src/index.ts. Required.
Branch Branch to commit the new file to (default: main). Required.
Commit Message Commit message describing the change. Required.
Content The content of the file to be created. Required.

Output

The node outputs JSON data representing the response from the GitLab API after creating the file. This typically includes metadata about the commit and the file, such as:

  • File path
  • Branch name
  • Commit ID and message
  • Author information
  • Timestamps

The output is structured as an array of JSON objects, each corresponding to an input item processed. There is no binary data output for this operation.


Dependencies

  • Requires access to a GitLab instance, either the public https://gitlab.com or a self-hosted GitLab server.
  • Requires an API access token with appropriate permissions to create files in the target repository.
  • Supports two authentication modes:
    • Using saved credentials configured in n8n.
    • Providing custom server URL and personal access token directly in the node parameters.

Troubleshooting

  • Invalid or missing credentials: Ensure that the access token has sufficient permissions to write to the repository. If using custom authentication, verify the server URL and token are correct.
  • Project identification errors: When using custom authentication, if both Project ID and Project Owner/Name are provided, the Project ID takes precedence. Make sure the project exists and the ID or namespace/name is accurate.
  • Branch does not exist: The branch specified must exist in the repository; otherwise, the API call will fail.
  • Commit message or content missing: Both commit message and file content are required. Leaving them empty will cause errors.
  • File path conflicts: If a file already exists at the specified path on the target branch, the create operation may fail. Use the update operation instead in such cases.

Common error messages usually come from the GitLab API and indicate permission issues, invalid parameters, or resource not found. Checking the exact API response in the node's output can help diagnose these problems.


Links and References

Discussion