Create a Repository on GitHub
To start developing for ClickHouse you will need a GitHub account. Please also generate an SSH key locally (if you don’t have one already) and upload the public key to GitHub as this is a prerequisite for contributing patches. Next, fork the ClickHouse repository in your personal account by clicking the “fork” button in the upper right corner. To contribute changes, e.g., a fix for an issue or a feature, first commit your changes to a branch in your fork, then create a “Pull Request” with the changes to the main repository. For working with Git repositories, please install Git. For example, in Ubuntu, run:Clone the repository to your development machine
First, download the source files to your working machine, i.e. clone the repository:ClickHouse/ containing the source code, tests, and other files.
You can specify a custom directory for checkout after the URL, but it is important that this path does not contain whitespaces as this may break the build later on.
ClickHouse’s Git repository uses submodules to pull in 3rd party libraries.
Submodules are not checked out by default.
You can either
-
run
git clonewith option--recurse-submodules, -
if
git cloneis run without--recurse-submodules, rungit submodule update --init --jobs <N>to checkout all submodules explicitly. (<N>can be set for example to12to parallelize the download.) -
if
git cloneis run without--recurse-submodulesand you like to use shallow submodule checkout to omit history in submodules to save some space, run./contrib/update-submodules.sh. This alternative is used by CI but not recommended for local development as it makes working with submodules less convenient and slower.
git submodule status.
If you get the following error message
~/.ssh.
For SSH keys to be accepted you need to upload them in GitHub’s settings.
You can also clone the repository via HTTPS:
git remote command.
You can also add original ClickHouse repo address to your local repository to pull updates from there:
git pull upstream master.
Writing code
Below you can find some quick links which may be useful when writing code for ClickHouse:IDE
Visual Studio Code and Neovim are two options that have worked well in the past for developing ClickHouse. If you are using VS Code, we recommend using the clangd extension to replace IntelliSense as it is much more performant. CLion is another great alternative. However, it can be slower on larger projects like ClickHouse. A few things to keep in mind when using CLion:- CLion creates a
buildpath on its own and automatically selectsdebugfor the build type - It uses a version of CMake that is defined in CLion and not the one installed by you
- CLion will use
maketo run build tasks instead ofninja(this is normal behavior)