Gitea
Connect Code Search to your Gitea instance.
Prerequisites
Section titled “Prerequisites”- Gitea 1.17 or later
- A user account with access to repositories
- An access token
Creating an Access Token
Section titled “Creating an Access Token”-
Go to your Gitea instance
-
Navigate to Settings → Applications → Manage Access Tokens
-
Create a new token:
- Name:
Code Search - Scopes: Select
read:repositoryandread:organization
- Name:
-
Click Generate Token
-
Copy the token immediately
Adding the Connection
Section titled “Adding the Connection”Via Web UI
Section titled “Via Web UI”- Go to Connections → Add Connection
- Fill in:
- Name:
Gitea - Type:
Gitea - URL:
https://gitea.yourcompany.com - Token: Your access token
- Name:
- Click Test Connection
- Click Create
Via API
Section titled “Via API”curl -X POST "http://localhost:8080/api/v1/connections" \ -H "Content-Type: application/json" \ -d '{ "name": "Gitea", "type": "gitea", "url": "https://gitea.yourcompany.com", "token": "xxxxxxxxxx" }'Via Configuration File
Section titled “Via Configuration File”Add code hosts to your config.yaml:
codehosts: # The key is the connection name gitea: type: gitea url: "https://gitea.yourcompany.com" token: "$CS_GITEA_TOKEN" # Environment variable reference exclude_archived: true # Skip archived repos during syncWith environment variable:
export CS_GITEA_TOKEN="your-access-token"Token Scopes
Section titled “Token Scopes”| Scope | Purpose |
|---|---|
read:repository | Access to repositories |
read:organization | Access organization repositories |
write:repository | Create pull requests (for replace) |
Hosted Gitea Services
Section titled “Hosted Gitea Services”Codeberg
Section titled “Codeberg”Codeberg is a public Gitea instance:
codehosts: codeberg: type: gitea url: "https://codeberg.org" token: "$CS_CODEBERG_TOKEN" exclude_archived: trueGitea Cloud (Gitea.com)
Section titled “Gitea Cloud (Gitea.com)”For Gitea’s hosted service:
codehosts: gitea-cloud: type: gitea url: "https://gitea.com" token: "$CS_GITEA_CLOUD_TOKEN" exclude_archived: trueRepository Discovery
Section titled “Repository Discovery”Code Search discovers:
- Repositories you own
- Repositories you’re a collaborator on
- Organization repositories you have access to
Syncing Repositories
Section titled “Syncing Repositories”After adding the connection:
- Click Sync on the connection card
- Code Search discovers your repositories
- Repositories are queued for indexing
Filtering Repositories
Section titled “Filtering Repositories”You can exclude archived repositories:
codehosts: gitea: type: gitea url: "https://gitea.yourcompany.com" token: "$CS_GITEA_TOKEN" exclude_archived: true # Skip archived repos during syncTroubleshooting
Section titled “Troubleshooting”Token not accepted
Section titled “Token not accepted”401 Unauthorized- Verify the token is correct
- Check token hasn’t expired
- Ensure required scopes are selected
Organization repos not found
Section titled “Organization repos not found”- Add
read:organizationscope to the token - Verify organization membership
Connection timeout
Section titled “Connection timeout”connection timeout- Verify the URL is correct
- Check network connectivity
- Ensure Gitea is running
Next Steps
Section titled “Next Steps”- Bitbucket - Connect to Bitbucket
- Configuration - Connection settings