gitlab api pro icon

gitlab api pro

Extended GitLab node

File → Update

AI-generated

Summary

Updates the content of an existing file in a GitLab repository by committing to a specified branch.

Inputs

  • Authentication — Select whether to use saved credentials or custom fields (default: credential).
  • GitLab Server — Base URL of your GitLab instance (used only with custom authentication).
  • Access Token — Personal access token with API permissions (used only with custom authentication).
  • Project Locator — Choose how to identify the project (ID or Path).
  • Project Owner — Namespace or owner of the project (used with Path locator).
  • Project Name — Project slug or name (used with Path locator).
  • Project ID — Numeric project ID (used with ID locator).
  • Path (required) — Path to the file to update, for example 'src/index.ts'.
  • Branch (required) — Branch to commit to (default: main).
  • Commit Message (required) — Commit message for the change.
  • Content (required) — File content.

Output shape

A list of items containing the updated file metadata (e.g., commit SHA, blob ID).

The operation uses the GitLab API 'repository files' endpoint with a PUT request. The file content must be Base64 encoded by the API (the node handles encoding).

Examples

Example 1: Update a configuration file on the main branch.

Set Project Locator to ID, provide Project ID, set Path to 'config/settings.', Branch to 'main', Commit Message to 'Update settings', and provide the new JSON content.

Example 2: Update a source file on a feature branch.

Set Project Locator to Path, provide Project Owner and Name, set Path to 'src/utils.js', Branch to 'feature/login', Commit Message to 'Refactor utils', and provide the new JavaScript code.

Links

Discussion