Skip to main content
Glama

git_config

Configure Git repository settings by setting or updating configuration keys and values for local, global, or system scopes to customize repository behavior.

Instructions

Configure git settings for the repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
scopeNoConfiguration scope (local, global, system)local
keyYesConfiguration key
valueYesConfiguration value

Implementation Reference

  • Main handler function that sets Git configuration for the repository using simpleGit.addConfig and returns formatted success or error response.
    export async function handleGitConfig({ repo_path, scope = "local", key, value, }) { try { const git = simpleGit(repo_path); // Set the configuration await git.addConfig(key, value, false, scope); return { content: [ { type: "text", text: JSON.stringify( { success: true, message: `Set ${scope} config ${key}=${value}`, key: key, value: value, scope: scope, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: `Failed to set git config: ${error.message}` }, null, 2 ), }, ], isError: true, }; } }
  • Input schema definition for the git_config tool, specifying parameters repo_path, scope, key, and value.
    { name: "git_config", description: "Configure git settings for the repository.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, scope: { type: "string", description: "Configuration scope (local, global, system)", default: "local", enum: ["local", "global", "system"], }, key: { type: "string", description: "Configuration key", }, value: { type: "string", description: "Configuration value", }, }, required: ["repo_path", "key", "value"], }, },
  • src/server.js:917-917 (registration)
    Maps the 'git_config' tool name to the handleGitConfig handler function in the handlersMap.
    git_config: handleGitConfig,
  • Imports the handleGitConfig function from config-operations.js for re-export.
    import { handleGitConfig } from "./config-operations.js";
  • Re-exports handleGitConfig as part of the handlers index module.
    // Config operations handleGitConfig,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bsreeram08/git-commands-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server