# How to Use the exclude_repo Parameter in GitHub Readme Stats to Hide Specific Repositories

> Learn to use the exclude_repo parameter in GitHub Readme Stats to hide specific repositories. Filter out unwanted repos from your stats cards easily and efficiently.

- Repository: [Anurag Hazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats)
- Tags: how-to-guide
- Published: 2026-02-28

---

**Set the `exclude_repo` query parameter to a comma-separated list of repository names, or configure the `EXCLUDE_REPO` environment variable on self-hosted instances, to filter out specific repositories from your Stats and Top Languages cards.**

The `exclude_repo` parameter in the `anuraghazra/github-readme-stats` repository provides a powerful mechanism for omitting specific repositories from your generated statistics cards. Whether you need to hide private experiments, forked repositories, or outdated projects, this parameter integrates seamlessly with both the public API and self-hosted deployments to give you granular control over your GitHub profile visualizations.

## How the exclude_repo Parameter Works Internally

The exclusion system operates through two complementary pathways that merge before data aggregation. According to the source code in `anuraghazra/github-readme-stats`, the implementation spans environment configuration and request-level parameters.

### Environment Variable Configuration

For self-hosted instances, the system reads the `EXCLUDE_REPO` variable from [`src/common/envs.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/src/common/envs.js). This comma-separated list is parsed and stored as `excludeRepositories`, providing a global exclusion list that applies to all incoming requests regardless of query parameters.

### Query Parameter Processing

When using the public API endpoint defined in [`api/index.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/api/index.js), the `exclude_repo` query parameter is extracted and converted to an array using the `parseArray` utility. This occurs at lines 86-92, where the parameter is sanitized and prepared for the fetcher functions.

### Repository Filtering Logic

Both [`src/fetchers/stats.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/src/fetchers/stats.js) and [`src/fetchers/top-languages.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/src/fetchers/top-languages.js) implement identical exclusion logic. The fetchers merge the environment-level exclusions with request-level exclusions into a single `Set` (referenced as `repoToHide` in the source). When processing GraphQL responses, repositories whose `name` property exists in this set are filtered out before calculating total stars or language statistics, ensuring excluded repositories never contribute to the final SVG output.

## Implementation Examples for the exclude_repo Parameter

### Public API Endpoint Usage

To exclude specific repositories from your Stats card via the public API, append the repository names as a comma-separated list:

```text
https://github-readme-stats.vercel.app/api?username=yourname&exclude_repo=repo1,repo2

```

This URL structure instructs the fetcher to omit `repo1` and `repo2` from star count calculations and repository totals.

### Self-Hosted Instance Configuration

For private deployments, configure the environment variable before starting the application:

```bash

# .env file or deployment platform environment settings

EXCLUDE_REPO=repo1,repo2,private-repo

```

After redeployment, all requests to your instance automatically exclude these repositories, even when clients do not specify the `exclude_repo` parameter.

### Combining Environment and Query Parameters

When both configuration methods are present, the system merges the exclusions:

```text
https://your-self-hosted-instance/api?username=yourname&exclude_repo=repo3

```

In this scenario, the response excludes `repo3` (from the query) plus any repositories defined in the `EXCLUDE_REPO` environment variable.

### Top Languages Card Exclusion

The `exclude_repo` parameter functions identically for the Top Languages card:

```text
https://github-readme-stats.vercel.app/api/top-langs?username=yourname&exclude_repo=repo1,repo2

```

Languages from the specified repositories are excluded from percentage calculations and the final visualization.

## Key Source Files for the exclude_repo Implementation

Understanding the codebase structure helps when debugging or extending functionality:

- **[`src/common/envs.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/src/common/envs.js)** — Reads and parses the `EXCLUDE_REPO` environment variable into the `excludeRepositories` constant.
- **[`api/index.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/api/index.js)** — Handles incoming HTTP requests, extracts the `exclude_repo` query parameter at lines 86-92, and converts it to an array using `parseArray`.
- **[`src/fetchers/stats.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/src/fetchers/stats.js)** — Implements the exclusion logic for the Stats card, merging environment and request exclusions into a `Set` and filtering repositories before star aggregation.
- **[`src/fetchers/top-languages.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/src/fetchers/top-languages.js)** — Applies identical filtering for language statistics, ensuring excluded repositories do not influence language percentages.

## Summary

The `exclude_repo` parameter in `github-readme-stats` provides flexible repository filtering through two complementary mechanisms:

- **Query Parameter**: Append `exclude_repo=repo1,repo2` to API URLs for per-request exclusions on the Stats or Top Languages cards.
- **Environment Variable**: Set `EXCLUDE_REPO` on self-hosted instances to enforce global exclusions across all requests.

Both methods merge seamlessly in the fetcher logic, ensuring specified repositories are filtered out before calculating stars, repository counts, or language statistics.

## Frequently Asked Questions

### What is the difference between EXCLUDE_REPO and exclude_repo?

The `EXCLUDE_REPO` environment variable configures global exclusions for self-hosted instances of `github-readme-stats`, affecting all incoming requests regardless of query parameters. The `exclude_repo` query parameter provides request-level exclusions that apply only to the specific API call. When both are present, the system merges the lists and excludes all specified repositories from the final statistics.

### Can I use exclude_repo with the Top Languages card?

Yes, the `exclude_repo` parameter works identically for the Top Languages card. When you append `exclude_repo=repo1,repo2` to the `/api/top-langs` endpoint, the fetcher filters out those repositories before calculating language percentages. This prevents languages from specific projects from dominating your statistics or hides repositories you do not want to include in your profile visualization.

### How do I exclude repositories on a self-hosted instance?

To exclude repositories on a self-hosted instance, set the `EXCLUDE_REPO` environment variable in your deployment configuration. Format the value as a comma-separated list of repository names (e.g., `EXCLUDE_REPO=repo1,repo2,private-repo`). After redeploying your instance, these repositories will be automatically excluded from all generated cards, even when clients do not explicitly request exclusion via query parameters.

### Does excluding a repository affect the star count on the Stats card?

Yes, excluding a repository removes its contribution from all aggregated metrics on the Stats card, including the total star count. When you specify repositories via `exclude_repo` or `EXCLUDE_REPO`, the fetcher in [`src/fetchers/stats.js`](https://github.com/anuraghazra/github-readme-stats/blob/main/src/fetchers/stats.js) filters out those repositories before summing stars and counting total repositories. The resulting SVG card reflects statistics calculated only from the remaining, non-excluded repositories.