# 搜索仓库

可以在任意组合中使用这些存储库搜索限定符搜索 GitHub 存储库并缩小结果范围。

可以全局搜索所有 GitHub存储库，也可以搜索特定组织中的存储库。 有关详细信息，请参阅“[关于在GitHub上的搜索](/zh/search-github/getting-started-with-searching-on-github/about-searching-on-github)”。

若要在搜索结果中包含分支，需要在查询中添加 `fork:true` 或 `fork:only`。 有关详细信息，请参阅“[在复刻中搜索](/zh/search-github/searching-on-github/searching-in-forks)”。

> \[!TIP]
>
> * 本文包含 GitHub.com 网站上示例搜索的链接，但你可以在任何 GitHub 平台中使用相同的搜索筛选器。 在链接的示例搜索中，将 `github.com` 替换为 GitHub 平台的主机名。
> * 有关可以添加到任何搜索限定符以进一步改善结果的搜索语法列表，请参阅 [了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)。
> * 对多个字词的搜索词使用引号。 例如，如果要搜索具有标签“In progress”的问题，可搜索 `label:"in progress"`。 搜索不区分大小写。

## 按仓库名称、仓库描述或自述文件内容搜索

通过 `in` 限定符，可将搜索范围限制到存储库名称、存储库说明、存储库主题、自述文件内容或这些项的任意组合。 如果省略此限定符，则仅搜索存储库名称、说明和主题。

| 限定符       | 示例 |
| --------- | -- |
| `in:name` |    |

```
          [
          **jquery in:name**](https://github.com/search?q=jquery+in%3Aname&type=Repositories) 匹配名称中带有“jquery”的存储库。
```

\| `in:description`  |
[
**jquery in:name,description**](https://github.com/search?q=jquery+in%3Aname%2Cdescription\&type=Repositories) 匹配名称或说明中带有“jquery”的存储库。
\| `in:topics`  |
**jquery in:topics** 匹配带有“jquery”作为主题标签的存储库。
\| `in:readme` |
[
**jquery in:readme**](https://github.com/search?q=jquery+in%3Areadme\&type=Repositories) 匹配自述文件中提及“jquery”的存储库。
\| `repo:owner/name` |
[
**repo:octocat/hello-world**](https://github.com/search?q=repo%3Aoctocat%2Fhello-world) 匹配特定的存储库名称。

## 基于仓库的内容搜索

可以使用 `in:readme` 限定符，通过搜索存储库自述文件中的内容来查找存储库。 有关详细信息，请参阅“[关于仓库 README 文件](/zh/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes)”。

除了使用 `in:readme`，无法通过搜索存储库中的特定内容来查找存储库。 要搜索仓库内的特定文件或内容，您可以使用查找器或代码特定的搜索限定符。 有关详细信息，请参阅 [在GitHub上查找文件](/zh/search-github/searching-on-github/finding-files-on-github) 和 （/search-github/github-code-search/understanding-github-code-search-syntax）。

| 限定符         | 示例 |
| ----------- | -- |
| `in:readme` |    |

```
          [
          **octocat in:readme**](https://github.com/search?q=octocat+in%3Areadme&type=Repositories) 匹配在存储库 README 文件中提到 “octocat” 的存储库。
```

## 在用户或组织的仓库内搜索

若要在特定用户或组织拥有的所有存储库中搜索，可使用 `user` 或 `org` 限定符。

| 限定符                                 | 示例 |
| ----------------------------------- | -- |
| <code>user:<em>USERNAME</em></code> |    |

```
          [
          **user:defunkt forks:&gt;100**](https://github.com/search?q=user%3Adefunkt+forks%3A%3E%3D100&type=Repositories) 匹配来自 @defunkt 且具有超过 100 个分支的存储库。
```

\| <code>org:<em>ORGNAME</em></code> |
[
**org：github**](https://github.com/search?utf8=%E2%9C%93\&q=org%3Agithub\&type=Repositories)匹配来自GitHub的存储库。

## 按仓库大小搜索

```
          `size` 限定符使用大于、小于和范围限定符查找与特定大小（以千字节为单位）匹配的存储库。 有关详细信息，请参阅“[AUTOTITLE](/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)”。
```

| 限定符                          | 示例 |
| ---------------------------- | -- |
| <code>size:<em>n</em></code> |    |

```
          [
          **size:1000**](https://github.com/search?q=size%3A1000&type=Repositories) 匹配大小正好为 1 MB 的存储库。
```

\| <code>size:><em>n</em></code> |
[
**size:>=30000**](https://github.com/search?q=size%3A%3E%3D30000\&type=Repositories) 匹配至少为 30 MB 的存储库。
\| <code>size:<<em>n</em></code> |
[
**size:<50**](https://github.com/search?q=size%3A%3C50\&type=Repositories) 匹配小于 50 KB 的存储库。
\| <code>size:<em>n..n</em></code> |
[
**size:50..120**](https://github.com/search?q=size%3A50..120\&type=Repositories) 匹配介于 50 KB 至 120 KB 之间的存储库。

## 按关注者数量搜索

可以使用 `followers` 限定符以及大于、小于和范围限定符，根据关注存储库的用户数量筛选存储库。 有关详细信息，请参阅“[了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)”。

| 限定符                                 | 示例 |
| ----------------------------------- | -- |
| <code>followers:>=<em>n</em></code> |    |

```
          [
          **node followers:>=10000**](https://github.com/search?q=node+followers%3A%3E%3D10000) 匹配有 10,000 名或更多关注者提及“node”一词的存储库。
```

\| <code>followers:<em>n..n</em></code> |
[
**styleguide linter followers:1..10**](https://github.com/search?q=styleguide+linter+followers%3A1..10\&type=Repositories) 找到有 1 至 10 名关注者、并提及“styleguide linter”一词的存储库。

## 按分支数量搜索

```
          `forks` 限定符使用大于、小于和范围限定符指定存储库应具有的分支数量。 有关详细信息，请参阅“[AUTOTITLE](/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)”。
```

| 限定符                           | 示例 |
| ----------------------------- | -- |
| <code>forks:<em>n</em></code> |    |

```
          [
          **forks:5**](https://github.com/search?q=forks%3A5&type=Repositories) 匹配只有五个分支的存储库。
```

\| <code>forks:><em>n</em></code> |
[
**forks:>=205**](https://github.com/search?q=forks%3A%3E%3D205\&type=Repositories) 匹配至少有 205 个分支的存储库。
\| <code>forks:<<em>n</em></code> |
[
**forks:<90**](https://github.com/search?q=forks%3A%3C90\&type=Repositories) 匹配具有少于 90 个分支的存储库。
\| <code>forks:<em>n..n</em></code> |
[
**forks:10..20**](https://github.com/search?q=forks%3A10..20\&type=Repositories) 匹配具有 10 到 20 个分支的存储库。

## 按星号数量搜索

您可以根据仓库的星级数量，使用大于、小于和范围限定符来搜索仓库。 有关详细信息，请参阅 [使用星标保存仓库](/zh/get-started/exploring-projects-on-github/saving-repositories-with-stars) 和 [了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)。

| 限定符                           | 示例 |
| ----------------------------- | -- |
| <code>stars:<em>n</em></code> |    |

```
          [
          **stars:500**](https://github.com/search?utf8=%E2%9C%93&q=stars%3A500&type=Repositories) 匹配正好有 500 个星标的存储库。
```

\| <code>
stars: <em>
n..n </em> </code> <code>
size:< <em>
n </em> </code>
|
**stars:10..20 size:<1000** 匹配星标数在 10 到 20 之间且小于 1000 KB 的存储库。
\| <code>
stars:>= <em>
n </em> </code>
`fork:true` <code>
language: <em>
LANGUAGE </em> </code>
|
[
**stars:>=500 fork:true language:php**](https://github.com/search?q=stars%3A%3E%3D500+fork%3Atrue+language%3Aphp\&type=Repositories) 匹配至少拥有 500 颗星的存储库（包括 fork 的存储库），且使用 PHP 编写。

## 按仓库创建或上次更新时间搜索

您可以基于创建时间或上次更新时间过滤仓库。 对于存储库创建，可以使用 `created` 限定符；要了解存储库的最后更新时间，需要使用 `pushed` 限定符。
`pushed` 限定符将返回存储库列表，按存储库中任意分支上最近进行的提交排序。

两者均采用日期作为参数。
日期格式必须遵循 [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) 标准，即 `YYYY-MM-DD`（年-月-日）。
也可以在日期后添加可选的时间信息 `THH:MM:SS+00:00`，以按小时、分钟和秒进行搜索。 即 `T`，随后是 `HH:MM:SS`（时-分-秒）和 UTC 时差 (`+00:00`)。

搜索日期时，可以使用大于、小于和范围限定符来进一步筛选结果。 有关详细信息，请参阅“[了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)”。

| 限定符                                       | 示例 |
| ----------------------------------------- | -- |
| <code>created:<<em>YYYY-MM-DD</em></code> |    |

```
          [
          **webos created:&lt;2011-01-01**](https://github.com/search?q=webos+created%3A%3C2011-01-01&type=Repositories) 匹配具有 2011 年之前创建的“webos”一词的存储库。
```

\| <code>pushed:><em>YYYY-MM-DD</em></code> |
[
**css pushed:>2013-02-01**](https://github.com/search?utf8=%E2%9C%93\&q=css+pushed%3A%3E2013-02-01\&type=Repositories) 匹配包含单词 “css” 且在 2013 年 1 月之后被推送更新的存储库。
\| <code>
pushed:>= <em>
YYYY-MM-DD </em> </code>
`fork:only`
|
[
**case pushed:>=2013-03-06 fork:only**](https://github.com/search?q=case+pushed%3A%3E%3D2013-03-06+fork%3Aonly\&type=Repositories) 匹配包含单词 “case”，并且在 2013 年 3 月 6 日或之后被推送更新且为 fork 的存储库。

## 按语言搜索

您可以根据仓库中代码的语言搜索仓库。

| 限定符                                     | 示例 |
| --------------------------------------- | -- |
| <code>language:<em>LANGUAGE</em></code> |    |

```
          [
          **
          `rails language:javascript`
          **
          ](https://github.com/search?q=rails+language%3Ajavascript&type=Repositories) 匹配包含“rails”一词并且用 JavaScript 编写的存储库。
```

## 按主题搜索

您可以找到按特定的主题归类的所有仓库。 有关详细信息，请参阅“[使用主题对仓库分类](/zh/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/classifying-your-repository-with-topics)”。

| 限定符                               | 示例 |
| --------------------------------- | -- |
| <code>topic:<em>TOPIC</em></code> |    |

```
          [
          **
          `topic:jekyll`
          **
          ](https://github.com/search?utf8=%E2%9C%93&q=topic%3Ajekyll&type=Repositories&ref=searchresults) 匹配按“Jekyll”主题分类的存储库。
```

## 按主题数量搜索

可以使用 `topics` 限定符以及大于、小于和范围限定符，根据应用于存储库的主题数量来搜索存储库。 有关详细信息，请参阅 [使用主题对仓库分类](/zh/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/classifying-your-repository-with-topics) 和 [了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)。

| 限定符                            | 示例 |
| ------------------------------ | -- |
| <code>topics:<em>n</em></code> |    |

```
          [
          **topics:5**](https://github.com/search?utf8=%E2%9C%93&q=topics%3A5&type=Repositories&ref=searchresults) 匹配具有五个主题的存储库。
```

\| <code>topics:><em>n</em></code> |
[
**topics:>3**](https://github.com/search?utf8=%E2%9C%93\&q=topics%3A%3E3\&type=Repositories\&ref=searchresults) 匹配具有三个以上主题的存储库。

## 按许可搜索

您可以根据仓库中许可的类型搜索仓库。 您必须使用许可关键字，按特定许可或许可系列来过滤仓库。 有关详细信息，请参阅“[为仓库颁发许可证](/zh/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository)”。

| 限定符                                            | 示例 |
| ---------------------------------------------- | -- |
| <code>license:<em>LICENSE\_KEYWORD</em></code> |    |

```
          [
          **license:apache-2.0**](https://github.com/search?utf8=%E2%9C%93&q=license%3Aapache-2.0&type=Repositories&ref=searchresults) 匹配根据 Apache 许可证 2.0 许可的存储库。
```

## 按仓库可见性搜索

您可以根据仓库的可见性过滤搜索。 有关详细信息，请参阅“[关于仓库](/zh/repositories/creating-and-managing-repositories/about-repositories#about-repository-visibility)”。

| 限定符         | 示例 |
| ----------- | -- |
| `is:public` |    |

```
          [
          **is：public org：github**](https://github.com/search?q=is%3Apublic+org%3Agithub&type=Repositories) 匹配由GitHub拥有的公共存储库。 |
```

\|   |
\| `is:private` |
[is:private pages\*\*\*\*](https://github.com/search?q=is%3Aprivate+pages\&type=Repositories) 会匹配你可以访问的包含“pages”一词的私有存储库。

## 基于存储库自定义属性搜索

可以使用带有 `props.` 前缀的限定符根据自定义属性筛选存储库。 有关详细信息，请参阅“[管理组织中存储库的自定义属性](/zh/organizations/managing-organization-settings/managing-custom-properties-for-repositories-in-your-organization)”。

要使这些限定符正常工作，搜索必须仅限于单个组织。 否则系统将忽略 `props.` 限定符。

| 限定符                                                 | 示例 |
| --------------------------------------------------- | -- |
| <code>props.<em>PROPERTY</em>:<em>VALUE</em></code> |    |

```
          [org：github props.environment：production****](https://github.com/search?utf8=%E2%9C%93&q=org%3Agithub+props.environment%3Atesting&type=Repositories) 匹配 `github` 组织中自定义属性 `environment` 设置为 `production` 的存储库。
```

## 根据仓库是否为镜像进行搜索

您可以根据仓库是否是镜像，以及是否托管在其他位置来搜索仓库。 有关详细信息，请参阅“[寻找在 GitHub 上参与开源的方法](/zh/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)”。

| 限定符           | 示例 |
| ------------- | -- |
| `mirror:true` |    |

```
          [
          **mirror:true GNOME**](https://github.com/search?utf8=%E2%9C%93&q=mirror%3Atrue+GNOME&type=) 匹配镜像，并且包含“GNOME”一词的存储库。
```

\|  `mirror:false` |
[
**mirror:false GNOME**](https://github.com/search?utf8=%E2%9C%93\&q=mirror%3Afalse+GNOME\&type=) 匹配不为镜像且包含“GNOME”一词的存储库。

## 根据存储库是否为模板搜索

你可以根据存储库是否是模板来搜索存储库。 有关详细信息，请参阅“[创建模板仓库](/zh/repositories/creating-and-managing-repositories/creating-a-template-repository)”。

| 限定符             | 示例 |
| --------------- | -- |
| `template:true` |    |

```
          **template:true GNOME** 匹配那些是模板并包含“GNOME”一词的存储库。
```

\| `template:false` |
**template:false GNOME** 匹配不是模板且包含“GNOME”一词的存储库。

## 基于代码库是否已存档进行搜索

您可以基于仓库是否已存档来搜索仓库。 有关详细信息，请参阅“[存档仓库](/zh/repositories/archiving-a-github-repository/archiving-repositories)”。

| 限定符             | 示例 |
| --------------- | -- |
| `archived:true` |    |

```
          [
          **archived:true GNOME**](https://github.com/search?utf8=%E2%9C%93&q=archived%3Atrue+GNOME&type=) 匹配已存档且包含“GNOME”一词的存储库。
```

\|  `archived:false` |
[
**archived:false GNOME**](https://github.com/search?utf8=%E2%9C%93\&q=archived%3Afalse+GNOME\&type=) 匹配未归档且包含单词 “GNOME” 的存储库。

## 根据带有 `good first issue` 或 `help wanted` 标签的议题数进行搜索

可以搜索具有至少一定数量标记为 `help-wanted` 或 `good-first-issue` 的议题的存储库，使用限定符 `help-wanted-issues:>n` 和 `good-first-issues:>n`。 有关详细信息，请参阅“[使用标签鼓励对项目做出有益的贡献](/zh/communities/setting-up-your-project-for-healthy-contributions/encouraging-helpful-contributions-to-your-project-with-labels)”。

| 限定符                    | 示例 |
| ---------------------- | -- |
| `good-first-issues:>n` |    |

```
          [
          **good-first-issues:&gt;2 javascript**](https://github.com/search?utf8=%E2%9C%93&q=javascript+good-first-issues%3A%3E2&type=) 匹配带有超过两个标记为 `good-first-issue` 的 issue 且包含单词“javascript”的存储库。
```

\| `help-wanted-issues:>n`|
[
**help-wanted-issues:>4 react**](https://github.com/search?utf8=%E2%9C%93\&q=react+help-wanted-issues%3A%3E4\&type=) 匹配具有四个以上标有 `help-wanted` 的议题且包含“React”一词的存储库。

## 基于赞助能力的搜索

你可以在 GitHub Sponsors 上使用 `is:sponsorable` 过滤条件搜索可被赞助的仓库所有者所属的存储库。 有关详细信息，请参阅“[关于GitHub赞助商](/zh/sponsors/getting-started-with-github-sponsors/about-github-sponsors)”。

可以使用 `has:funding-file` 限定符搜索具有融资文件的存储库。 有关详细信息，请参阅“[在代码库中显示赞助按钮](/zh/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository#about-funding-files)”。

| 限定符                | 示例                                                                                                                                     |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `is:sponsorable`   | [              **is:sponsorable**](https://github.com/search?q=is%3Asponsorable\&type=Repositories) 匹配其所有者具有 GitHub Sponsors 配置文件的存储库。 |
| `has:funding-file` |                                                                                                                                        |

```
          [
          **has:funding-file**](https://github.com/search?q=has%3Afunding-file&type=Repositories) 匹配具有 FUNDING.yml 文件的存储库。
```

## 基于部署上下文进行搜索

如果组织已将记录添加到其中 linked artifacts page，则可以使用此数据筛选存储库列表，例如组织的“存储库”页。 有关详细信息，请参阅“[关于关联的项目](/zh/code-security/concepts/supply-chain-security/linked-artifacts)”。

| 限定符               | 说明                                          |
| ----------------- | ------------------------------------------- |
| `deployable:true` | 在 linked artifacts page 中，该存储库存在活动**存储记录**。 |
| `deployed:true`   | 在 linked artifacts page 中，该存储库存在活动**部署记录**。 |

## 延伸阅读

* [排序搜索结果](/zh/search-github/getting-started-with-searching-on-github/sorting-search-results)
* [在复刻中搜索](/zh/search-github/searching-on-github/searching-in-forks)