How do I search GitHub for repos with two files by filename?
I've tried a couple of search synaxes.
filename:file1.txt filename:file2.txt path:/
The above search only returns file1.txt
filename:file1.txt AND filename:file2.txt path:/
I get the following error
We could not perform this search
The search contains only logical operators (AND / OR / NOT) without any search terms.
TL;DR. This is not currently possible with the GitHub search engine. Although you can bypass the restriction on search terms, you still won't be able to search by filenames in a repository.
How to bypass the restriction on searches?
We could not perform this search
The search contains only logical operators (AND / OR / NOT) without any search terms.
You can bypass this specific restriction by adding a new term in your predicate:
filename:file1.txt AND filename:file2.txt NOT randomtextthatwillnotbefound
NOT randomtextthatwillnotbefound counts as a search term and you're pretty much assured that it's equivalent to not adding anything (as far as the text doesn't contain randomtextthatwillnotbefound).
Restriction on filename selector.
Bypassing the previous restriction will not be sufficient however. If you use the filename selector you will only have results of type Code. You cannot search repositories that way.
In addition, since you'll have results of type Code, a search result file cannot be called both file1.txt and file2.txt and you'll end up with 0 results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With