> For the complete documentation index, see [llms.txt](https://docs.graphlit.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graphlit.dev/api-guides/use-cases/feeds/cloud-storage/feed-create-github.md).

# Create GitHub Repository Feed

## User Intent

"How do I sync files from a GitHub repository? Show me GitHub repo feed configuration."

## Operation

**SDK Method**: `createFeed()` with FeedTypes.Site\
**Auth**: GitHub personal access token or OAuth

***

## Code Example (TypeScript)

```typescript
import { Graphlit } from 'graphlit-client';
import { FeedTypes, FeedServiceTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

const feed = await graphlit.createFeed({
  name: 'GraphQL Docs',
  type: FeedTypes.Site,
  site: {
    type: FeedServiceTypes.GitHub,
    github: {
      repositoryOwner: 'graphql',
      repositoryName: 'graphql-spec',
      personalAccessToken: process.env.GITHUB_TOKEN!,
    },
    allowedPaths: ['spec/**', 'README.md'],
    readLimit: 1000,
  },
  // Optional: add workflow for content processing
  // workflow: { id: workflow.createWorkflow.id }
});

console.log(`Created GitHub repo feed: ${feed.createFeed.id}`);
```

***

## Configuration

**repositoryOwner**: GitHub username or organization\
**repositoryName**: Repository name\
**personalAccessToken**: GitHub PAT\
**allowedPaths**: Array of path patterns to include\
**excludedPaths**: Array of path patterns to exclude\
**readLimit**: Maximum files to sync

***

## Path Filtering

**Include specific directories**:

```typescript
allowedPaths: ['docs/**', 'examples/**']
```

**Exclude patterns**:

```typescript
excludedPaths: ['node_modules/**', '*.lock', '.git/**']
```

**File type filtering**:

```typescript
allowedPaths: ['**/*.md', '**/*.ts']
```

***

## What Gets Synced

* Repository **files** (source code, docs, READMEs, configuration files)
* File metadata (path, size, modified date)

This feed does **not** sync GitHub Issues, Pull Requests, or Commits. Use the dedicated GitHub issue/PR/commit feeds for those.

***

## How Updates Work

* After the initial sync, the feed polls and ingests **new or changed** files.
* **Unchanged** files are not reprocessed on every poll.
* If you need deletions to be reflected, configure the feed `syncMode` to `MIRROR`.

***

## Cost and Scope Controls

To avoid unexpectedly large backfills:

* Start with narrow `allowedPaths` (and expand later).
* Use `excludedPaths` to skip large folders and build output.
* Keep `readLimit` conservative.
* Avoid binaries and large assets when possible.

To monitor usage, see: [Query Project Usage](/api-guides/use-cases/production/project-query-usage.md).

***

## Use Cases

**Documentation Sync**:

```typescript
repositoryOwner: 'facebook',
repositoryName: 'react',
allowedPaths: ['docs/**']
```

**Code Search**:

```typescript
repositoryOwner: 'vercel',
repositoryName: 'next.js',
allowedPaths: ['**/*.ts', '**/*.tsx']
```

**Examples Library**:

```typescript
repositoryOwner: 'graphlit',
repositoryName: 'graphlit-samples',
allowedPaths: ['python/**', 'nextjs/**']
```

***

## Private vs Public Repos

**Public Repos**:

* Can use token with `public_repo` scope
* No special permissions needed

**Private Repos**:

* Requires token with full `repo` scope
* Must have repository access

***

## Related

* [GitHub Issues Feed](/api-guides/use-cases/feeds/project-management/feed-create-github-issues.md) - Sync issues
* [GitHub Commits Feed](/api-guides/use-cases/feeds/project-management/feed-create-github-commits.md) - Sync commits
* [GitHub Pull Requests Feed](/api-guides/use-cases/feeds/project-management/feed-create-github-pull-requests.md) - Sync pull requests
* [Web Crawl](/api-guides/use-cases/feeds/web/feed-create-web-crawl.md) - Crawl any website
