You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

command-line.en-us.md 8.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. ---
  2. date: "2017-01-01T16:00:00+02:00"
  3. title: "Usage: Command Line"
  4. slug: "command-line"
  5. weight: 10
  6. toc: true
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "usage"
  11. name: "Command Line"
  12. weight: 10
  13. identifier: "command-line"
  14. ---
  15. ## Command Line
  16. ### Usage
  17. `gitea [global options] command [command or global options] [arguments...]`
  18. ### Global options
  19. All global options can be placed at the command level.
  20. - `--help`, `-h`: Show help text and exit. Optional.
  21. - `--version`, `-v`: Show version and exit. Optional. (example: `Gitea version 1.1.0+218-g7b907ed built with: bindata, sqlite`).
  22. - `--custom-path path`, `-C path`: Location of the Gitea custom folder. Optional. (default: `AppWorkPath`/custom or `$GITEA_CUSTOM`).
  23. - `--config path`, `-c path`: Gitea configuration file path. Optional. (default: `custom`/conf/app.ini).
  24. - `--work-path path`, `-w path`: Gitea `AppWorkPath`. Optional. (default: LOCATION_OF_GITEA_BINARY or `$GITEA_WORK_DIR`)
  25. NB: The defaults custom-path, config and work-path can also be
  26. changed at build time (if preferred).
  27. ### Commands
  28. #### web
  29. Starts the server:
  30. - Options:
  31. - `--port number`, `-p number`: Port number. Optional. (default: 3000). Overrides configuration file.
  32. - `--pid path`, `-P path`: Pidfile path. Optional.
  33. - Examples:
  34. - `gitea web`
  35. - `gitea web --port 80`
  36. - `gitea web --config /etc/gitea.ini --pid /var/run/gitea.pid`
  37. - Notes:
  38. - Gitea should not be run as root. To bind to a port below 1000, you can use setcap on
  39. Linux: `sudo setcap 'cap_net_bind_service=+ep' /path/to/gitea`. This will need to be
  40. redone every time you update Gitea.
  41. #### admin
  42. Admin operations:
  43. - Commands:
  44. - `create-user`
  45. - Options:
  46. - `--name value`: Username. Required. As of gitea 1.9.0, use the `--username` flag instead.
  47. - `--username value`: Username. Required. New in gitea 1.9.0.
  48. - `--password value`: Password. Required.
  49. - `--email value`: Email. Required.
  50. - `--admin`: If provided, this makes the user an admin. Optional.
  51. - `--must-change-password`: If provided, the created user will be required to choose a newer password after
  52. the initial login. Optional. (default: true).
  53. - ``--random-password``: If provided, a randomly generated password will be used as the password of
  54. the created user. The value of `--password` will be discarded. Optional.
  55. - `--random-password-length`: If provided, it will be used to configure the length of the randomly
  56. generated password. Optional. (default: 12)
  57. - Examples:
  58. - `gitea admin create-user --username myname --password asecurepassword --email me@example.com`
  59. - `change-password`
  60. - Options:
  61. - `--username value`, `-u value`: Username. Required.
  62. - `--password value`, `-p value`: New password. Required.
  63. - Examples:
  64. - `gitea admin change-password --username myname --password asecurepassword`
  65. - `regenerate`
  66. - Options:
  67. - `hooks`: Regenerate git-hooks for all repositories
  68. - `keys`: Regenerate authorized_keys file
  69. - Examples:
  70. - `gitea admin regenerate hooks`
  71. - `gitea admin regenerate keys`
  72. - `auth`:
  73. - `list`:
  74. - Description: lists all external authentication sources that exist
  75. - Examples:
  76. - `gitea admin auth list`
  77. - `delete`:
  78. - Options:
  79. - `--id`: ID of source to be deleted. Required.
  80. - Examples:
  81. - `gitea admin auth delete --id 1`
  82. - `add-oauth`:
  83. - Options:
  84. - `--name`: Application Name.
  85. - `--provider`: OAuth2 Provider.
  86. - `--key`: Client ID (Key).
  87. - `--secret`: Client Secret.
  88. - `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
  89. - `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
  90. - `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
  91. - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
  92. - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
  93. - `--custom-email-url`: Use a custom Email URL (option for GitHub).
  94. - Examples:
  95. - `gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE`
  96. - `update-oauth`:
  97. - Options:
  98. - `--id`: ID of source to be updated. Required.
  99. - `--name`: Application Name.
  100. - `--provider`: OAuth2 Provider.
  101. - `--key`: Client ID (Key).
  102. - `--secret`: Client Secret.
  103. - `--auto-discover-url`: OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider).
  104. - `--use-custom-urls`: Use custom URLs for GitLab/GitHub OAuth endpoints.
  105. - `--custom-auth-url`: Use a custom Authorization URL (option for GitLab/GitHub).
  106. - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
  107. - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
  108. - `--custom-email-url`: Use a custom Email URL (option for GitHub).
  109. - Examples:
  110. - `gitea admin auth update-oauth --id 1 --name external-github-updated`
  111. #### cert
  112. Generates a self-signed SSL certificate. Outputs to `cert.pem` and `key.pem` in the current
  113. directory and will overwrite any existing files.
  114. - Options:
  115. - `--host value`: Comma seperated hostnames and ips which this certificate is valid for.
  116. Wildcards are supported. Required.
  117. - `--ecdsa-curve value`: ECDSA curve to use to generate a key. Optional. Valid options
  118. are P224, P256, P384, P521.
  119. - `--rsa-bits value`: Size of RSA key to generate. Optional. Ignored if --ecdsa-curve is
  120. set. (default: 2048).
  121. - `--start-date value`: Creation date. Optional. (format: `Jan 1 15:04:05 2011`).
  122. - `--duration value`: Duration which the certificate is valid for. Optional. (default: 8760h0m0s)
  123. - `--ca`: If provided, this cert generates it's own certificate authority. Optional.
  124. - Examples:
  125. - `gitea cert --host git.example.com,example.com,www.example.com --ca`
  126. #### dump
  127. Dumps all files and databases into a zip file. Outputs into a file like `gitea-dump-1482906742.zip`
  128. in the current directory.
  129. - Options:
  130. - `--file name`, `-f name`: Name of the dump file with will be created. Optional. (default: gitea-dump-[timestamp].zip).
  131. - `--tempdir path`, `-t path`: Path to the temporary directory used. Optional. (default: /tmp).
  132. - `--skip-repository`, `-R`: Skip the repository dumping. Optional.
  133. - `--database`, `-d`: Specify the database SQL syntax. Optional.
  134. - `--verbose`, `-V`: If provided, shows additional details. Optional.
  135. - Examples:
  136. - `gitea dump`
  137. - `gitea dump --verbose`
  138. #### generate
  139. Generates random values and tokens for usage in configuration file. Useful for generating values
  140. for automatic deployments.
  141. - Commands:
  142. - `secret`:
  143. - Options:
  144. - `INTERNAL_TOKEN`: Token used for an internal API call authentication.
  145. - `JWT_SECRET`: LFS & OAUTH2 JWT authentication secret (LFS_JWT_SECRET is aliased to this option for backwards compatibility).
  146. - `SECRET_KEY`: Global secret key.
  147. - Examples:
  148. - `gitea generate secret INTERNAL_TOKEN`
  149. - `gitea generate secret JWT_SECRET`
  150. - `gitea generate secret SECRET_KEY`
  151. #### keys
  152. Provides an SSHD AuthorizedKeysCommand. Needs to be configured in the sshd config file:
  153. ```ini
  154. ...
  155. # The value of -e and the AuthorizedKeysCommandUser should match the
  156. # username running gitea
  157. AuthorizedKeysCommandUser git
  158. AuthorizedKeysCommand /path/to/gitea keys -e git -u %u -t %t -k %k
  159. ```
  160. The command will return the appropriate authorized_keys line for the
  161. provided key. You should also set the value
  162. `SSH_CREATE_AUTHORIZED_KEYS_FILE=false` in the `[server]` section of
  163. `app.ini`.
  164. NB: opensshd requires the gitea program to be owned by root and not
  165. writable by group or others. The program must be specified by an absolute
  166. path.