Getting Qt Sources from the Git repository | Qt 6.11
Description: This page describes how to clone and initialize Qt repositories.

- Qt 6.11
- Getting Started with Qt
- Get and Install Qt
- Building Qt Sources
- Getting Qt Sources from the Git repository
- Qt 6.11.2 Reference Documentation

Building Qt Sources ◦ Qt Configure Options

# Getting Qt Sources from the Git repository

This page describes how to get the Qt sources from the public Git repositories. The Git repositories contain the latest development branches and released versions of Qt 6.

You can also get the Qt sources Qt Online Installer, through your Qt Account (commercial users), or from download.qt.io (open-source users).

You need a recent version of Git and CMake Documentation to run the `init-repository` tool when initializing the Git submodules.

Note: These instructions assume you are familiar with using command-line tools.

## Cloning the Qt repository

Qt is developed and maintained in several Git submodules in the main `qt5.git` repository. Getting the Qt sources from Git involves cloning the top-level Git repository through the command line.

Note: Qt 5 and Qt 6 share the same repository, `qt5.git`, and you will get the Qt 5 repository even if you use Qt 6.

These instructions use Unix-like shell syntax. On Windows, the commands are similar. The command below clones the current version of Qt 6 into a directory named `qt`.

     git clone --branch v6.11.2 git://code.qt.io/qt/qt5.git qt

If the git protocol is blocked by your firewall, consider using HTTPS instead:

     git clone --branch v6.11.2 https://code.qt.io/qt/qt5.git qt

After cloning, the `qt` directory contains the main Qt Git repository which contains setup files and uninitialized Qt submodules.

## Initializing the Qt submodules

The `qt5.git` repository contains the Qt Modules as Git submodules. To initialize and clone the submodules, run the `init-repository` tool in the top-level directory.

     ./init-repository

On Windows, without a Linux environment, use `init-repository.bat` instead.

     init-repository.bat

`init-repository` clones and initializes setup files to build the Qt sources. In addition, there are tools in the repository that help Qt contributors with creating patches, testing code, and generating documentation. For more information about contributing, visit the Contributing to Qt site.

If you already have a Qt repository in the same directory, you can pass `-f` to force `init-repository` to reinitialize the submodules.

     ./init-repository -f

## Initializing Qt specific submodules

If you only need a specific set of Qt modules, initialize a minimal set of submodules using `--module-subset` as an argument to `init-repository`. For example, you can initialize only the Qt Essentials modules by specifying `essential` as the argument.

     ./init-repository --module-subset=essential

For Qt Add-Ons, use `addon` instead.

     ./init-repository --module-subset=addon

You can also select several submodules at the same time. For example, to initialize the `qtgrpc` and `qtmqtt` submodules along with their required submodules, run:

     ./init-repository --module-subset=qtgrpc,qtmqtt

The `init-repository` tool always initializes a minimum set of submodules.

For more information, consult the `init-repository` manual by setting `-help` as an argument:

     ./init-repository -help

## After cloning and initializing

The next step is to configure and build Qt. Read the Building Qt Sources page for more information.

Building Qt Sources ◦ Qt Configure Options