Skip to main content

About searching on GitHub

Our integrated search covers the many repositories, users, and lines of code on GitHub.

您可以全局搜索所有 GitHub,也可搜索特定仓库或组织。

  • To search globally across all of GitHub, type what you're looking for into the search field at the top of any page, and choose "All GitHub" in the search drop-down menu.
  • To search within a particular repository or organization, navigate to the repository or organization page, type what you're looking for into the search field at the top of the page, and press Enter.

Notes:

  • 您必须登录到 GitHub 上的个人帐户才能在所有公共仓库中搜索代码。
  • GitHub Pages sites are not searchable on GitHub. However you can search the source content if it exists in the default branch of a repository, using code search. For more information, see "Searching code." For more information about GitHub Pages, see "What is GitHub Pages?"
  • Currently our search doesn't support exact matching.
  • Whenever you are searching in code files, only the first two results in each file will be returned.

After running a search on GitHub, you can sort the results, or further refine them by clicking one of the languages in the sidebar. For more information, see "Sorting search results."

GitHub search uses an ElasticSearch cluster to index projects every time a change is pushed to GitHub. Issues and pull requests are indexed when they are created or modified.

Types of searches on GitHub

You can search for the following information across all repositories you can access on GitHub.com.

Searching using a visual interface

You can search GitHub using the 搜索 页面 or 高级搜索 页面. Alternatively, you can use the interactive search in the GitHub 命令面板 to search your current location in the UI, a specific user, repository or organization, and globally across all of GitHub, without leaving the keyboard. For more information, see "GitHub 命令面板."

The 高级搜索 页面 provides a visual interface for constructing search queries. You can filter your searches by a variety of factors, such as the number of stars or number of forks a repository has. As you fill in the advanced search fields, your query will automatically be constructed in the top search bar.

Advanced Search

Searching repositories on GitHub.com from your private enterprise environment

If you use both GitHub.com and GitHub Enterprise Server or GitHub AE, and an enterprise owner has enabled 统一搜索, you can search across both environments at the same time from GitHub Enterprise Server or GitHub AE. For more information, see the GitHub Enterprise Server documentation or the GitHub AE documentation.

Further reading