16

Is there a way to search for all files with a certain name in all repositories on GitHub?

I've seen the advanced search form, but I can't see anything in there.

If there isn't anything on the GitHub website, is there any other way to do this?

I'm looking to produce various interesting statistics (a simple example is, how many README files are there on GitHub? But there are a broader range of questions.)

3 Answers 3

12

Try this:

README.txt in:path

(maybe you will need to click on "Code" on the left side of the search page)

Source: https://help.github.com/articles/searching-code

0
6

the in:path kinda worked, but searching for

.travis.yml in:path

only returned about 6.8 million entries.

I was about to find 15 million using

filename:.travis.yml
1
  • This answer could be improved by clarifying the reason for the difference. Considerations for code search describes the complexity and some of the associated implications of approaches. eg "You can't use the following wildcard characters as part of your search query: . , : ; / ``` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ] @. The search will simply ignore these symbols."
    – Blindspots
    Aug 18 at 16:11
2

Legacy Syntax

The in:path qualifier described in the accepted answer from 2014 is now part of GitHub's legacy syntax and should only be used if searching code using the REST API endpoint.

Current Syntax

The current path qualifier syntax as described in GitHub's documentation, Understanding GitHub Code Search syntax:

Path Qualifier

To search within file paths, use the path: qualifier. This will match files containing the term anywhere in their file path. For example, to find files containing the term unit_tests in their path, use:

path:unit_tests

The above query will match both src/unit_tests/test.py and src/docs/unit_tests.md since they both contain unit_test somewhere in their path.

The path qualifier also supports regular expressions and has some limited support for glob expressions.

1
  • Great example of late answer. đź‘ŤValuable info. I edited to include GitHub's documentation and reference to same as well as the answer this replaces.
    – Blindspots
    Aug 18 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.