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


date: “2016-12-01T16:00:00+02:00” title: “Hacking on Gitea” slug: “hacking-on-gitea” weight: 10 toc: false draft: false menu: sidebar:

parent: "advanced"
name: "Hacking on Gitea"
weight: 10
identifier: "hacking-on-gitea"

Hacking on Gitea

Installing go and setting the GOPATH

You should install go and set up your go environment correctly. In particular, it is recommended to set the $GOPATH environment variable and to add the go bin directory or directories ${GOPATH//://bin:}/bin to the $PATH. See the Go wiki entry for GOPATH.

You will also need make. }}‘>instructions for }}‘>configuration cheat sheet found in docs/content/doc/advanced/

When changing the Gitea logo SVG, you will need to run and commit the results of:

make generate-images

This will create the necessary Gitea favicon and others.

Database Migrations

If you make breaking changes to any of the database persisted structs in the models/ directory, you will need to make a new migration. These can be found in models/migrations/. You can ensure that your migrations work for the main database types using:

make test-sqlite-migration # with sqlite switched for the appropriate database


There are two types of test run by Gitea: Unit tests and Integration Tests.

TAGS="bindata sqlite sqlite_unlock_notify" make test # Runs the unit tests

Unit tests will not and cannot completely test Gitea alone. Therefore, we have written integration tests; however, these are database dependent.

TAGS="bindata sqlite sqlite_unlock_notify" make generate build test-sqlite

will run the integration tests in an sqlite environment. Other database tests are available but may need adjustment to the local environment.

Look at integrations/ for more information and how to run a single test.

Our continuous integration will test the code passes its unit tests and that all supported databases will pass integration test in a Docker environment. Migration from several recent versions of Gitea will also be tested.

Please submit your PR with additional tests and integration tests as appropriate.

Documentation for the website

Documentation for the website is found in docs/. If you change this you can test your changes to ensure that they pass continuous integration using:

cd "$GOPATH/src/"
make trans-copy clean build

You will require a copy of Hugo to run this task. Please note: this may generate a number of untracked git objects, which will need to be cleaned up.

Visual Studio Code

A launch.json and tasks.json are provided within contrib/ide/vscode for Visual Studio Code. Look at contrib/ide/ for more information.

Submitting PRs

Once you’re happy with your changes, push them up and open a pull request. It is recommended that you allow Gitea Managers and Owners to modify your PR branches as we will need to update it to master before merging and/or may be able to help fix issues directly.

Any PR requires two approvals from the Gitea maintainers and needs to pass the continous integration. Take a look at our document.

If you need more help pop on to Discord #Develop and chat there.

That’s it! You are ready to hack on Gitea.