Interactive installation and configuration script for Forgejo, a self-hosted Git service.
All runtime files are hosted under /home/git. System-level files (systemd unit) are placed there too and symlinked into the appropriate system directories.
- Linux (x86_64, arm64, or armv7l)
bash≥ 4.0curl,git,opensslsystemd- Root access (
sudo) - Optional:
gpgfor binary signature verification
# Clone the repository
git clone https://github.com/eviweb/forgejo-installer.git
cd forgejo-installer
# Run the installer (interactive)
sudo ./forgejo-setup.sh
# or explicitly
sudo ./forgejo-setup.sh installThe script will prompt for:
Essential parameters (with sensible defaults):
- Forgejo version (default: latest stable)
- Domain name
- HTTP and SSH ports
- Database type (SQLite3, MySQL, PostgreSQL)
Optional parameters (prompted as yes/no):
- Application name
- Public registration policy
- Repository indexer
- SMTP mailer
sudo forgejo-setup.sh [command] [options]
Commands:
install Install and configure Forgejo (default)
uninstall Remove Forgejo
Options:
-h, --help Show help
-v, --version Show version
--keep-data On uninstall, preserve /home/git
The script resolves its real path via readlink, so it is safe to call through a symlink:
sudo ln -s /path/to/forgejo-setup.sh /usr/local/bin/forgejo-setup
sudo forgejo-setup install/home/git/
├── bin/forgejo ← Forgejo binary
├── forgejo/
│ ├── custom/conf/app.ini ← main configuration
│ ├── data/ ← runtime data
│ └── log/ ← log files
├── repositories/ ← git repositories
├── .ssh/ ← SSH keys
├── forgejo.service ← systemd unit (source)
└── .git/ ← configuration version tracking
/etc/systemd/system/forgejo.service → symlink → /home/git/forgejo.service
Configuration files under /home/git are tracked in a local git repository. Changes are committed automatically by the installer.
Tests use bats-core.
# Install bats (Debian/Ubuntu)
sudo apt install bats
# Run all tests
./run_tests.sh
# Run a specific test file
./run_tests.sh tests/test_cli.batsService fails to start
Check the journal: journalctl -u forgejo -n 50 --no-pager
Port already in use
Verify with ss -tlnp | grep <port> and choose a different port during setup.
Permission denied on /home/git
The git user must own /home/git. Run: sudo chown -R git:git /home/git
Binary checksum mismatch Re-run the installer — the script will re-download the binary. Ensure your network connection is stable.
See CONTRIBUTING.md for commit conventions, test instructions, and the pull request workflow.
To report a vulnerability, see SECURITY.md. Do not open a public issue.