> For the complete documentation index, see [llms.txt](https://litedb.gitbook.io/litedb-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://litedb.gitbook.io/litedb-docs/getting_started/installation.md).

# 下载源码

LiteDB 源码托管在 GitHub：[Icingworld/litedb](https://github.com/Icingworld/litedb)。本节说明如何获取最新代码或指定历史版本。编译步骤见 [编译源码](/litedb-docs/getting_started/building.md)。

## 环境准备

下载源码前，请确保本机已安装：

* [Git](https://git-scm.com/)

项目依赖独立 Asio，通过 Git 子模块 `third_party/asio` 引入。克隆时需要一并拉取子模块。

## 克隆最新源码

使用 `--recurse-submodules` 一次性拉取主仓库与子模块：

```sh
git clone --recurse-submodules https://github.com/Icingworld/litedb.git
cd litedb
```

若克隆时未带上子模块，可在仓库根目录补拉：

```sh
git submodule update --init --recursive
```

默认检出的是 `main` 分支，对应当前开发主干。

## 下载指定版本

LiteDB 通过 Git 标签发布版本（例如 `v0.7.1`、`v0.7.0`）。获取某一历史版本有两种常用方式。

### 方式一：克隆后切换到标签

```sh
git clone --recurse-submodules https://github.com/Icingworld/litedb.git
cd litedb
git checkout v0.7.1
git submodule update --init --recursive
```

切换标签后务必再次执行 `git submodule update`，以保证子模块与该版本一致。

### 方式二：浅克隆指定标签

若只需要某一发布版本、不需要完整提交历史，可浅克隆该标签：

```sh
git clone --depth 1 --branch v0.7.1 --recurse-submodules https://github.com/Icingworld/litedb.git
cd litedb
```

可用标签列表见仓库的 [Tags](https://github.com/Icingworld/litedb/tags) 页面，或在已克隆的仓库中执行：

```sh
git tag --sort=-v:refname
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://litedb.gitbook.io/litedb-docs/getting_started/installation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
