Development version

This documentation is for a Forgejo version which is not yet released.

To read the documentation for the released version of Forgejo, navigate to the latest version.

Command-line interface

Forgejo comes with a command-line interface (CLI) for administrative actions. It is documented below and is not to be confused with user CLIs that can be used to interact with a Forgejo instance.

forgejo --help

NAME:
   forgejo - Beyond coding. We forge.

USAGE:
   forgejo [global options] [command [command options]]


DESCRIPTION:
   By default, forgejo will start serving using the web-server with no argument, which can alternatively be run by running the subcommand "web".

COMMANDS:
   help, h          Shows a list of commands or help for one command
   web              Start the Forgejo web server
   serv             (internal) Should only be called by SSH shell
   hook             (internal) Should only be called by Git
   keys             (internal) Should only be called by SSH server
   dump             Dump Forgejo files and database
   admin            Perform common administrative operations
   migrate          Migrate the database
   doctor           Diagnose and optionally fix problems, convert or re-create database tables
   manager          Manage the running forgejo process
   embedded         Extract embedded resources
   migrate-storage  Migrate the storage
   dump-repo        Dump the repository from git/github/gitea/gitlab
   restore-repo     Restore the repository from disk
   actions          Manage Forgejo Actions
   cert             Generate self-signed certificate
   generate         Generate Forgejo's secrets/keys/tokens
   forgejo-cli      Forgejo CLI

GLOBAL OPTIONS:
   --version, -v                    print the version
   --help, -h                       show help
   --custom-path string, -C string  Set custom path (defaults to '{WorkPath}/custom')
   --config string, -c string       Set custom config file (defaults to '{WorkPath}/custom/conf/app.ini')
   --work-path string, -w string    Set Forgejo's working path (defaults to the directory of the Forgejo binary)
   --help, -h                       show help
   --version, -v                    print the version

forgejo-cli

NAME:
   forgejo forgejo-cli - Forgejo CLI

USAGE:
   forgejo forgejo-cli [command [command options]]

COMMANDS:
   actions  Commands for managing Forgejo Actions

OPTIONS:
   --help, -h  show help

forgejo-cli actions

NAME:
   forgejo forgejo-cli actions - Commands for managing Forgejo Actions

USAGE:
   forgejo forgejo-cli actions [command [command options]]

COMMANDS:
   generate-runner-token  Generate a new token for a runner to use to register with the server
   generate-secret        Generate a secret suitable for input to the register subcommand
   register               Idempotent registration of a runner using a shared secret

OPTIONS:
   --help, -h  show help

forgejo-cli actions generate-runner-token

NAME:
   forgejo forgejo-cli actions generate-runner-token - Generate a new token for a runner to use to register with the server

USAGE:
   forgejo forgejo-cli actions generate-runner-token [options]

OPTIONS:
   --scope string, -s string  {owner}[/{repo}] - leave empty for a global runner
   --help, -h                 show help

GLOBAL OPTIONS:
   --custom-path string, -C string  Set custom path (defaults to '{WorkPath}/custom')
   --config string, -c string       Set custom config file (defaults to '{WorkPath}/custom/conf/app.ini')
   --work-path string, -w string    Set Forgejo's working path (defaults to the directory of the Forgejo binary)

forgejo-cli actions generate-secret

NAME:
   forgejo forgejo-cli actions generate-secret - Generate a secret suitable for input to the register subcommand

USAGE:
   forgejo forgejo-cli actions generate-secret [options]

OPTIONS:
   --help, -h  show help

GLOBAL OPTIONS:
   --custom-path string, -C string  Set custom path (defaults to '{WorkPath}/custom')
   --config string, -c string       Set custom config file (defaults to '{WorkPath}/custom/conf/app.ini')
   --work-path string, -w string    Set Forgejo's working path (defaults to the directory of the Forgejo binary)

forgejo-cli actions register

NAME:
   forgejo forgejo-cli actions register - Idempotent registration of a runner using a shared secret

USAGE:
   forgejo forgejo-cli actions register [options]

OPTIONS:
   --secret string            the secret the runner will use to connect as a 40 character hexadecimal string
   --secret-stdin string      the secret the runner will use to connect as a 40 character hexadecimal string, read from stdin
   --secret-file string       path to the file containing the secret the runner will use to connect as a 40 character hexadecimal string
   --scope string, -s string  {owner}[/{repo}] - leave empty for a global runner
   --labels string            comma separated list of labels supported by the runner (e.g. docker,ubuntu-latest,self-hosted)  (not required since v1.21)
   --keep-labels              do not affect the labels when updating an existing runner
   --name string              name of the runner (default runner) (default: "runner")
   --version string           version of the runner (not required since v1.21)
   --ephemeral                instruct Forgejo to permanently unregister this runner after it has run one job
   --help, -h                 show help

GLOBAL OPTIONS:
   --custom-path string, -C string  Set custom path (defaults to '{WorkPath}/custom')
   --config string, -c string       Set custom config file (defaults to '{WorkPath}/custom/conf/app.ini')
   --work-path string, -w string    Set Forgejo's working path (defaults to the directory of the Forgejo binary)