# GitLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/git/GitLoader)

Load `Git` repository files.

The Repository can be local on disk available at `repo_path`,
or remote at `clone_url` that will be cloned to `repo_path`.
Currently, supports only text files.

Each document represents one file in the repository. The `path` points to
the local Git repository, and the `branch` specifies the branch to load
files from. By default, it loads from the `main` branch.

## Signature

```python
GitLoader(
    self,
    repo_path: str,
    clone_url: Optional[str] = None,
    branch: Optional[str] = 'main',
    file_filter: Optional[Callable[[str], bool]] = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `repo_path` | `str` | Yes | The path to the Git repository. |
| `clone_url` | `Optional[str]` | No | Optional. The URL to clone the repository from. (default: `None`) |
| `branch` | `Optional[str]` | No | Optional. The branch to load files from. Defaults to `main`. (default: `'main'`) |
| `file_filter` | `Optional[Callable[[str], bool]]` | No | Optional. A function that takes a file path and returns a boolean indicating whether to load the file. Defaults to None. (default: `None`) |

## Extends

- `BaseLoader`

## Constructors

```python
__init__(
    self,
    repo_path: str,
    clone_url: Optional[str] = None,
    branch: Optional[str] = 'main',
    file_filter: Optional[Callable[[str], bool]] = None,
)
```

| Name | Type |
|------|------|
| `repo_path` | `str` |
| `clone_url` | `Optional[str]` |
| `branch` | `Optional[str]` |
| `file_filter` | `Optional[Callable[[str], bool]]` |


## Properties

- `repo_path`
- `clone_url`
- `branch`
- `file_filter`

## Methods

- [`lazy_load()`](https://reference.langchain.com/python/langchain-community/document_loaders/git/GitLoader/lazy_load)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/document_loaders/git.py#L9)