Skip to main content
GitTool provides methods to execute common Git operations on local repositories.

Installation

Install the Git dependency:

Constructor

api_key
str
Optional API key for MCP server usage

Methods

clone

Clone a repository from a remote URL.
repo_url
str
required
Git repository URL (HTTPS or SSH)
to_path
str
required
Local path where repository will be cloned
Returns: Success message or error

pull

Pull changes from the remote repository.
repo_path
str
required
Path to local Git repository
Returns: Success message or error

commit

Commit all changes in the repository.
repo_path
str
required
Path to local Git repository
message
str
required
Commit message
Returns: Confirmation with commit message

push

Push commits to the remote repository.
repo_path
str
required
Path to local Git repository
Returns: Success message or error

status

Get the current status of the repository.
repo_path
str
required
Path to local Git repository
Returns: Git status output

Usage

With Agentor agent

Clone a repository

Commit and push workflow

Pull updates

Notes

The commit method automatically stages all changes (equivalent to git add -A) before committing.
GitTool requires appropriate Git credentials for push/pull operations. Make sure SSH keys or credential helpers are configured.

Error handling

Source reference

src/agentor/tools/git.py:25
Last modified on May 5, 2026