Create or update file contents
GitHub create or update file contents tool to create a new file or update an existing file in a GitHub repository. This is a write tool that creates a commit with the file changes, including support for custom commit metadata such as author, committer, branch, and SHA validation.
Replace deprecated GitHub tools
Use Create or update file (GitHub MCP) (create_or_update_file) instead of the deprecated githubcommitsinglefile tool.
Prerequisites
-
Your admin must install and configure the GitHub connector, add the GitHub tools under Admin console → Platform → Tools, and enable this tool.
-
A GitHub app must be installed on the relevant organization(s) and linked to the correct GitHub connector in the Glean Admin console.
-
The GitHub app must have write permissions to repository contents.
Supported parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Owner | String | Yes | The account owner of the repository (case-insensitive). |
| Repository | String | Yes | The name of the repository without the .git extension (case-insensitive). |
| File path | String | Yes | The full path to the file in the repository, including filename and extension. |
| Content | String | Yes | The new file content, Base64 encoded (e.g., "SGVsbG8gV29ybGQ=" for "Hello World"). |
| Commit message | String | Yes | The commit message for this file creation or update. |
| Branch | String | No | The branch name to create or update the file on (defaults to repository's default branch). |
| Author name | String | No | The commit author's name (requires author email if provided). |
| Author email | String | No | The commit author's email (requires author name if provided). |
| Author date | String | No | The author's timestamp in ISO 8601 format (defaults to committer date). |
| Committer name | String | No | The committer's name (requires committer email if provided). |
| Committer email | String | No | The committer's email (requires committer name if provided). |
| Committer date | String | No | The committer's timestamp in ISO 8601 format (defaults to current time). |
| SHA | String | No | The blob SHA of the file being replaced for validation (auto-fetched if omitted). |
Note: If author and committer details are omitted, GitHub uses the authenticated user's identity for both.
Usage examples
-
"Create a new README.md file in the 'myorg/myproject' repository with the content 'Welcome to My Project'."
-
"Update the config.json file in 'facebook/react' on the 'develop' branch with new configuration settings."
-
"Add a new API documentation file at 'docs/api/endpoints.md' in the 'microsoft/vscode' repository."