> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codecrafters.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Large files found

> Instructions on resolving error related to large files

When pushing your changes, you might see a message indicating that some files exceed the 1MB size limit:

![](https://mintcdn.com/codecrafters/qGKwe-_AIUAS3RUS/img/large-file-error.png?fit=max\&auto=format\&n=qGKwe-_AIUAS3RUS\&q=85\&s=70869be208dcdf8148fc6e49cde0b50d)

If you encounter an error like this, it's likely due to inadvertently committing files that are too large or not meant to be tracked (e.g., binaries or `node_modules/`).

Depending on when these large files entered your Git history, there are two ways to resolve this.

## Solution 1: Amend last commit (Try this first)

**1. Stage the large files for deletion**

Run the following command:

```bash theme={null}
git rm LARGE_FILE
```

This command removes the large files from your Git repository and locally.

For example to delete the `./server` and `./release/target` binaries shown in the screenshot above, run the following command:

```bash theme={null}
git rm server release/target
```

**2. Commit the changes**

```bash theme={null}
git commit --amend --no-edit --allow-empty
```

This will amend the previous commit with the changes.

**3. Push the code**

Finally, push your code:

```bash theme={null}
git push origin master
```

If Solution 1 doesn't work, it means the large files are present in an older commit and will require some extra work. Follow the instructions in Solution 2 below.

## Solution 2: Amend historical commits

**1. Install `git repo-filter`**

You can install [git-filter-repo](https://github.com/newren/git-filter-repo) manually or by using a package manager. For example, to install the tool with Homebrew, run the following command:

```bash theme={null}
brew install git-filter-repo
```

For more information, see [INSTALL.md](https://github.com/newren/git-filter-repo/blob/main/INSTALL.md)

**2. Delete the large files**

Delete each of the large files using the following command:

```bash theme={null}
git filter-repo --invert-paths --path PATH-TO-LARGE-FILE
```

This will remove the file from your Git history and local filesystem.
\[!NOTE] Add the *path* to the files you want to remove, not just their filename.

**3. Restore your remotes and push**

The `git filter-repo` tool will automatically remove your configured remote CodeCrafters Git repository. Restore it using the following steps:

Copy the CodeCrafters Git repository URL from the dropdown menu:

![](https://mintcdn.com/codecrafters/qGKwe-_AIUAS3RUS/img/copy-git-url.png?fit=max\&auto=format\&n=qGKwe-_AIUAS3RUS\&q=85\&s=dccbf7dfc834062a888956d4e420317b)

Run the following command in your local project folder:

```bash theme={null}
git remote add origin CODECRAFTERS-GIT-URL
```

Finally, force-push your code:

```bash theme={null}
git push origin --force --all
```

> [!NOTE]
>
> If you're still running into issues after trying the the two steps above,
> please reach out to us at
> [hello@codecrafters.io](mailto:hello@codecrafters.io) and we'll help out!&#x20;


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.