Simple authentication filter for cgit powered by SQLite and Redis.
- Cookie-based session authentication with configurable TTL
- Password hashing with Argon2
- Per-repository access control lists (ACL)
- Flexible protection modes: protect all repos, selected repos, or none
- Session storage via Redis for fast cookie validation
- Built-in login page served by the filter
- Database migration support (v2 to v3)
- Pre-built binaries for Linux (amd64/aarch64) and macOS (arm64)
cargo build --releaseThe binary will be at target/release/cgit-simple-authentication.
cgit-simple-authentication database initThis creates the SQLite database at the configured location (default: /etc/cgit/auth.db).
cgit-simple-authentication user add admin hunter2Add the filter to your cgitrc:
auth-filter=/opt/cgit-simple-authentication/cgit-simple-authentication
All options are set in the cgitrc file:
| Option | Default | Description |
|---|---|---|
cgit-simple-auth-cookie-ttl |
1200 |
Cookie time to live in seconds |
cgit-simple-auth-database |
/etc/cgit/auth.db |
SQLite database file path |
cgit-simple-auth-bypass-root |
false |
Skip authentication on the repository list (root) page |
cgit-simple-auth-protect |
full |
Protection mode: full, part, or none |
full(default) -- All repositories require authentication. Individual repos can opt out withrepo.protect=false.part-- No repositories are protected by default. Individual repos can opt in withrepo.protect=true.none-- Authentication is disabled entirely.
When using part mode, enable protection for specific repositories:
repo.url=my-private-repo
repo.protect=true
When using full mode, disable protection for specific repositories:
repo.url=my-public-repo
repo.protect=false
When a repository is protected, you can control which users have access:
# Grant a user access to a repository
cgit-simple-authentication repo add my-repo alice
# Revoke a user's access
cgit-simple-authentication repo del my-repo alice
# Remove all users from a repository's ACL
cgit-simple-authentication repo del my-repo --clear-all
# List all repository ACLs
cgit-simple-authentication repo list
# Show ACL for a specific repository
cgit-simple-authentication repo list my-repoLogs are written to /var/cache/cgit/auth.log by default. Override with the LOG_FILE environment variable.
# Add a user
cgit-simple-authentication user add <username> <password>
# Delete a user
cgit-simple-authentication user del <username>
# List all users
cgit-simple-authentication user list# Initialize the database
cgit-simple-authentication database init
# Upgrade from v2 (0.3.x) to v3 (0.4.x+)
cgit-simple-authentication database upgrade
# Reset the database (requires --confirm)
cgit-simple-authentication database reset --confirmInspired by: https://github.com/varphone/cgit-gogs-auth-filter
Copyright (C) 2021-2026 KunoiSayami
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
