Skip to main content

关于在 GitHub 上搜索

我们的集成搜索涵盖了 GitHub Enterprise Cloud 上的许多仓库、用户和代码行。

About searching on GitHub

You can search globally across all of GitHub Enterprise Cloud, or scope your search to a particular repository or organization.

  • To search globally across all of GitHub Enterprise Cloud, type what you're looking for into the search field at the top of any page, and choose "Search all of GitHub" in the search dropdown 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.

    You can also use suggestions and completions in the search bar to quickly find what you need.

  • If you click on the search bar in the top navigation of GitHub.com, you will see a list of suggestions organized by category, including recent searches and suggested repositories, teams, and projects that you have access to.

  • Clicking on any of the specific suggestions will take you directly to the page for that suggestion (for example, the repository or project page). If you click on a recent search, depending on the type of search, the search term will appear in the search bar or you will be taken to the search results page for the search term.

  • Once you start typing, you will see a list of completions and suggestions that match your query. You can click on a suggestion to jump to a specific location. As you continue to type, you will see more specific suggestions, such as code files you can jump to directly.

After typing a search query, you can press Enter to go to the full search results view, where you can see each match and a visual interface for applying filters. For more information, see "Searching using a visual interface."

Notes:

  • You must be signed into a personal account on GitHub Enterprise Cloud to search for code across all public repositories.
  • GitHub Pages sites are not searchable on GitHub Enterprise Cloud. However you can search the source content if it exists in the default branch of a repository, using code search. For more information, see "Understanding GitHub Code Search syntax." For more information about GitHub Pages, see "About GitHub Pages"
  • Currently our search doesn't support exact matching.

After running a search on GitHub Enterprise Cloud, 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 Enterprise Cloud search uses an ElasticSearch cluster to index projects every time a change is pushed to GitHub Enterprise Cloud. 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.

Searching using a visual interface

In addition to the search bar, you can search GitHub Enterprise Cloud using the search page or advanced search page. Alternatively, you can use the interactive search in the GitHub Command Palette to search your current location in the UI, a specific user, repository or organization, and globally across all of GitHub Enterprise Cloud, without leaving the keyboard. For more information, see "GitHub Command Palette."

The advanced search page 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 page. Top search bar holds "kittens user:octocat" query. Under "Advanced options", "From these owners" text box holds term "octocat".

Searching repositories on GitHub.com from your private enterprise environment

If you use both GitHub.com and GitHub Enterprise Server, and an enterprise owner has enabled unified search, you can search across both environments at the same time from GitHub Enterprise Server. For more information, see "About searching on GitHub" in the GitHub Enterprise Server documentation.

Further reading