> 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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.graphlit.dev/api-guides/use-cases/feeds/cloud-storage/feed-create-github.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
