supermemory/apps/docs/connectors/github.mdx
mintlify[bot] 61dd8afcf6
Update apps/docs/connectors/github.mdx
Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
2025-12-19 01:09:10 +00:00

207 lines
7.5 KiB
Text

---
title: GitHub Connector
description: Connect your GitHub repositories to Supermemory for intelligent code and documentation search
---
## GitHub Connector
The GitHub connector allows you to import and search across your GitHub repositories, including code files, issues, pull requests, and documentation. Supermemory intelligently indexes your GitHub content, making it searchable and accessible through the Memory API.
## Features
- **Repository Indexing**: Automatically index files from your GitHub repositories
- **Code Search**: Search across code files with semantic understanding
- **Issue & PR Search**: Find relevant issues and pull requests
- **Automatic Updates**: Keep your indexed content in sync with repository changes via webhooks
- **Custom OAuth**: Use your own GitHub OAuth app for enhanced control
## Connecting GitHub
### Using Default OAuth
1. Navigate to **Dashboard** → **Connectors**
2. Click **Connect** on the GitHub connector card
3. Authorize Supermemory to access your GitHub account
4. Select the repositories you want to index
5. Click **Save** to start indexing
### Using Custom OAuth Credentials
Organizations can configure custom GitHub OAuth credentials for enhanced control and branding. This is useful for:
- **Enterprise Requirements**: Meet specific security and compliance requirements
- **Rate Limits**: Avoid shared rate limits by using your own OAuth application
- **Branding**: Customize the OAuth authorization screen with your organization's branding
- **Access Control**: Fine-tune permissions and access scopes
#### Setting Up Custom GitHub OAuth
**Step 1: Create a GitHub OAuth App**
1. Go to [GitHub Developer Settings](https://github.com/settings/developers)
2. Click **OAuth Apps** → **New OAuth App**
3. Configure your OAuth application:
- **Application name**: Your organization name (e.g., "Acme Corp - Supermemory")
- **Homepage URL**: Your organization's website
- **Authorization callback URL**: `https://api.supermemory.ai/auth/github/callback`
- **Application description**: Optional description for users
4. Click **Register application**
5. Save your **Client ID** (visible on the app page)
6. Click **Generate a new client secret** and save it securely
<Warning>
Store your Client Secret securely. You won't be able to see it again after leaving the page.
</Warning>
**Step 2: Configure in Supermemory**
1. Navigate to **Advanced Settings** in your Supermemory dashboard
2. Scroll to the **GitHub** section under **Custom OAuth Credentials**
3. Toggle **Use custom client keys** to enable
4. Enter your **Client ID** and **Client Secret**
5. Click **Save Changes**
**Step 3: Reconnect GitHub**
After configuring custom credentials, you'll need to reconnect your GitHub account:
1. Go to **Dashboard** → **Connectors**
2. Disconnect your existing GitHub connection (if any)
3. Click **Connect** to authorize using your custom OAuth app
4. Select repositories and complete the setup
#### Credential Requirements
Your custom GitHub OAuth credentials must meet these requirements:
**Client ID:**
- Minimum 10 characters
- Maximum 50 characters
- Alphanumeric characters, dots, underscores, and hyphens only
**Client Secret:**
- Exactly 40 characters
- Hexadecimal format (0-9, a-f)
<Note>
Client Secrets are encrypted before storage and never displayed after saving. If you lose your secret, you'll need to generate a new one in GitHub.
</Note>
## Supported Content Types
The GitHub connector can index the following content types:
- **Source Code**: All programming languages and text files
- **Markdown Files**: README, documentation, and wiki pages
- **Issues**: Issue titles, descriptions, and comments
- **Pull Requests**: PR titles, descriptions, and code changes
- **Discussions**: GitHub Discussions content
## Filtering and Selection
### Repository Selection
Choose which repositories to index:
- **All Repositories**: Index all repositories you have access to
- **Selected Repositories**: Choose specific repositories to index
- **Organization Repositories**: Index all repositories from specific organizations
### File Filtering
Configure which files to include or exclude:
```json
{
"include": ["*.md", "*.ts", "*.tsx", "*.js"],
"exclude": ["node_modules/**", "dist/**", "*.test.ts"]
}
```
## Webhooks and Auto-Sync
Supermemory can automatically sync changes from your GitHub repositories using webhooks:
1. Navigate to your repository settings on GitHub
2. Go to **Settings** → **Webhooks** → **Add webhook**
3. Set the Payload URL to: `https://api.supermemory.ai/webhooks/github`
4. Select **Content type**: `application/json`
5. Choose events: **Push**, **Pull requests**, **Issues**
6. Click **Add webhook**
<Info>
Webhooks ensure your indexed content stays up-to-date automatically without manual re-indexing.
</Info>
## Permissions and Scopes
The GitHub connector requires the following OAuth scopes:
- `repo`: Access to private repositories (if selected)
- `read:org`: Read organization membership
- `read:user`: Read user profile information
## Troubleshooting
### Connection Issues
If you're having trouble connecting GitHub:
1. **Check OAuth App Status**: Ensure your OAuth app is active in GitHub settings
2. **Verify Callback URL**: Confirm the callback URL matches exactly: `https://api.supermemory.ai/auth/github/callback`
3. **Review Permissions**: Make sure you've granted the necessary permissions during authorization
4. **Check Rate Limits**: Verify you haven't exceeded GitHub API rate limits
### Custom OAuth Not Working
If custom OAuth credentials aren't working:
1. **Validate Credentials**: Ensure Client ID and Secret meet the format requirements
2. **Regenerate Secret**: If you suspect the secret is incorrect, generate a new one in GitHub
3. **Clear Cache**: Disconnect and reconnect the GitHub connector
4. **Check Encryption**: Verify the credentials were saved successfully in Advanced Settings
### Indexing Issues
If repositories aren't indexing properly:
1. **Check Repository Access**: Ensure Supermemory has access to the repositories
2. **Review File Filters**: Verify your include/exclude patterns aren't too restrictive
3. **Monitor Processing Status**: Check the [Track Processing Status](/docs/memory-api/track-progress) page
4. **Webhook Configuration**: Ensure webhooks are properly configured for auto-sync
## Best Practices
- **Use Custom OAuth for Production**: Configure custom OAuth credentials for production environments
- **Selective Indexing**: Only index repositories that contain relevant content
- **Regular Monitoring**: Check the [Analytics Dashboard](/docs/analytics) to monitor indexing status
- **Webhook Setup**: Configure webhooks for automatic updates
- **Access Control**: Regularly review which repositories are connected and indexed
## API Integration
You can programmatically manage GitHub connections using the Supermemory API:
```typescript
// List GitHub connections
const connections = await supermemory.connections.list({
provider: 'github'
});
// Trigger manual sync
await supermemory.connections.sync({
connectionId: 'conn_123',
provider: 'github'
});
```
See [Managing Connection Resources](/docs/memory-api/connectors/managing-resources) for more details.
## Security
- **OAuth Tokens**: All OAuth tokens are encrypted at rest
- **Scoped Access**: Only requested permissions are granted
- **Audit Logs**: Connection activities are logged for security auditing
- **Automatic Expiry**: Tokens are automatically refreshed and expired tokens are removed
For more information about organization-wide settings, see [Organization Settings](/docs/org-settings).