Skip to content

Gitea

Connect Code Search to your Gitea instance.

  • Gitea 1.17 or later
  • A user account with access to repositories
  • An access token
  1. Go to your Gitea instance

  2. Navigate to Settings → Applications → Manage Access Tokens

  3. Create a new token:

    • Name: Code Search
    • Scopes: Select read:repository and read:organization
  4. Click Generate Token

  5. Copy the token immediately

  1. Go to ConnectionsAdd Connection
  2. Fill in:
    • Name: Gitea
    • Type: Gitea
    • URL: https://gitea.yourcompany.com
    • Token: Your access token
  3. Click Test Connection
  4. Click Create
Terminal window
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"
}'

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 sync

With environment variable:

Terminal window
export CS_GITEA_TOKEN="your-access-token"
ScopePurpose
read:repositoryAccess to repositories
read:organizationAccess organization repositories
write:repositoryCreate pull requests (for replace)

Codeberg is a public Gitea instance:

codehosts:
codeberg:
type: gitea
url: "https://codeberg.org"
token: "$CS_CODEBERG_TOKEN"
exclude_archived: true

For Gitea’s hosted service:

codehosts:
gitea-cloud:
type: gitea
url: "https://gitea.com"
token: "$CS_GITEA_CLOUD_TOKEN"
exclude_archived: true

Code Search discovers:

  • Repositories you own
  • Repositories you’re a collaborator on
  • Organization repositories you have access to

After adding the connection:

  1. Click Sync on the connection card
  2. Code Search discovers your repositories
  3. Repositories are queued for indexing

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 sync
401 Unauthorized
  • Verify the token is correct
  • Check token hasn’t expired
  • Ensure required scopes are selected
  • Add read:organization scope to the token
  • Verify organization membership
connection timeout
  • Verify the URL is correct
  • Check network connectivity
  • Ensure Gitea is running