Is it possible to search for a particular filename on GitHub?

GithubSearch Engine

Github Problem Overview


I know that the GitHub web interface lets you search all repositories for files with a particular pathname (e.g. searching for path:/app/models/user.rb yields > 109k results), but is there a way to search all repositories for filenames independent of their subdirectory location? I tried using asterisks in the path argument, and that didn't seem to work.

Github Solutions


Solution 1 - Github

Does the [search][1] user.rb in:path do what you want to do? Alternatively there is also this [search][2] filename:user.rb

Found on: https://help.github.com/articles/searching-code/

[1]: https://github.com/search?utf8=%E2%9C%93&q=user.rb%20in%3Apath&type=Code&ref=searchresults "search" [2]: https://github.com/search?utf8=%E2%9C%93&q=filename%3Auser.rb&type=Code&ref=searchresults "search"

Solution 2 - Github

In search input, you can use filename parameter to search in multiple repositories, for example:

filename:my_filename.txt

If you're looking for a filename in specific repository, you can just press t and start typing the file name (see: GH keyboard shortcuts).

Solution 3 - Github

GitHub introduced FileFinder in 2011.

>Try it out: just hit t on any repo's file or directory view.[1]

So, You're still restricted to repository.

[1]https://github.com/blog/793-introducing-the-file-finder

Another approach to Your question:

https://stackoverflow.com/q/277546/1150918

Solution 4 - Github

In my case, I wanted to search for a particular file name, in all of my organization's repositories. This can be done by entering this in the search box:

org:your-organization-user-name filename:the-file-name

Of course, just do "filename:the-file-name" if you want to search the whole of GitHub.

I didn't see this in https://help.github.com/articles/searching-code/ but found out when I switched context, and GitHub entered the filter for me automaticallly.

Solution 5 - Github

I would like to clarify @ajain's answer.

  1. In Github Web UI, you have to already be in the Reop's directory view.

enter image description here


  1. Then, press the T key. A file finder appears.

enter image description here


  1. Enter a filename to open it.

enter image description here


More shortcuts for source code browsing.

Solution 6 - Github

You can try Google. Google for filename.txt site:github.com.

Solution 7 - Github

I refined @andy-lester answer with intitle:, i.e. I want to find where's located the file simple_spinner_item.xml in Android's source code hosted on github, so I search on Google this string:

site:github.com intitle:simple_spinner_item.xml github.com/android

^                       ^                       ^
|                       |                       |
on github site          |                       |
                        |                       |
filename I'm searching -+                       |
                                                |
github user ------------------------------------+

Solution 8 - Github

  1. In git Repo Click on "Go to file". It will show "repo/".
  2. Enter specific file name.

Solution 9 - Github

Just press "t" and It will let you search for a file.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPeter AlfvinView Question on Stackoverflow
Solution 1 - GithubOrangenhainView Answer on Stackoverflow
Solution 2 - GithubkenorbView Answer on Stackoverflow
Solution 3 - GithubKamiccoloView Answer on Stackoverflow
Solution 4 - GithubNagevView Answer on Stackoverflow
Solution 5 - GithubPenny LiuView Answer on Stackoverflow
Solution 6 - GithubAndy LesterView Answer on Stackoverflow
Solution 7 - GithubMaxChinniView Answer on Stackoverflow
Solution 8 - GithubShah VipulView Answer on Stackoverflow
Solution 9 - GithubajainView Answer on Stackoverflow