Skip to content

eviweb/forgejo-installer

Repository files navigation

forgejo-installer

Tests Version License: MIT

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.

Requirements

  • Linux (x86_64, arm64, or armv7l)
  • bash ≥ 4.0
  • curl, git, openssl
  • systemd
  • Root access (sudo)
  • Optional: gpg for binary signature verification

Installation

# 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 install

The 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

Usage

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

Symlink usage

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

Installed layout

/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.

Development

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.bats

Troubleshooting

Service 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.

Contributing

See CONTRIBUTING.md for commit conventions, test instructions, and the pull request workflow.

Security

To report a vulnerability, see SECURITY.md. Do not open a public issue.

License

MIT

About

Help to install Forgejo more easily

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages