Gitea

Gitea is an open source, lightweight code hosting solution. You can find the official documentation here.

See also

Gitea is front-end application for Git. If you want to clone a git repository, please see the Cloning a Repository Hosted on your WebFaction Server section of our Git page for additional documentation.

Enable Public Registrations

Gitea has public registration enabled by default, to avoid unwanted registrations our installer disables this setting. To enable public registration:

  1. Open an SSH session to your account.
  2. Open /home/username/webapps/gitea_app/custom/conf/app.ini in a text editor, where:
  • username is your account name, and
  • gitea_app is the name of your Gitea application.
  1. Set DISABLE_REGISTRATION to false.
  2. Save and close the file.
  3. Restart the Gitea application. Enter /home/username/webapps/gitea_app/bin/restart and press Enter.

Set Gitea to Production Mode

Our installer starts Gitea in dev mode by default. After you are done configuring to your needs, you should set it to production mode. To set Gitea to production mode:

  1. Open an SSH session to your account.
  2. Open /home/username/webapps/gitea_app/custom/conf/app.ini in a text editor, where:
  • username is your account name, and
  • gitea_app is the name of your Gitea application.
  1. Set RUN_MODE to prod.
  2. Save and close the file.
  3. Restart the Gitea application. Enter /home/username/webapps/gitea_app/bin/restart and press Enter.

Edit First User’s Email Address

When our installer creates the first user, which has full admin privileges, it sets the email to username@username.webfactional.com. To change this to something more useful:

  1. Open http://domain.example/user/settings/ in a web browser, where domain.example is the Gitea site’s domain name and URL path.
  2. In the Email field, enter the email you want to use.
  3. Click the Update Profile button.

Configure Gitea to Send Email

To Configure Gitea to send mail:

  1. Open an SSH session to your account.

  2. Open /home/username/webapps/gitea_app/custom/conf/app.ini in a text editor, where:

    • username is your account name, and
    • gitea_app is the name of your Gitea application.
  3. Add these lines:

    [mailer]
    ENABLED = true
    SUBJECT = %(APP_NAME)s
    HOST = smtp.webfaction.com:587
    FROM = <adddress>
    USER = <mailbox>
    PASSWD = <password>
    

where:

  • <address> is an email address configured in the WebFaction control panel. This is the domain name your Gitea application will send mail from (such as git@example.domain),
  • <mailbox> is a mailbox name as it appears in the WebFaction control panel (for example, username_gitea), and
  • <password> is the mailbox’s password.
  1. Save and close the file.
  2. Restart the Gitea application. Enter /home/username/webapps/gitea_app/bin/restart and press Enter.

Remove Public Keys After you have Deleted the App

You can easily manage public keys for the user’s that you have provided access to your repos using Gitea’s UI. If you have deleted the application though, without removing any users first, chances are their public keys are still in your account’s ~/.ssh/authorized_keys file.

Don’t worry, they will not have ssh access to your account or be able to browse your files, as the only command they can run is the gitea executable (which was removed from the filesystem when the application was deleted in the control panel).

To keep things neat and tidy you will have to remove the keys that are related to your Gitea app from the ~/.ssh/authorized_keys file manually. You can do this using your favourite text editor over an SSH session, or through FTP.

If your Gitea app was named for example codehub, a line added to your keys file would look like:

command="/home/username/webapps/codehub/gitea serv key-1 --config='/home/username/webapps/codehub/custom/conf/app.ini'",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3Nza...[truncated]

You should remove all lines that contain a reference to your codehub Gitea application.