![](/img/trans.png)
[英]How to search a GitHub fork for code using the GitHub Search API?
[英]How to search using GitHub API in private organizations
我有一個私有組織GitHub(企業)存儲庫,例如github.mycompany.com
。
我想使用GitHub API在代碼中搜索字符串。 我如何在搜索mycompany
特異性GitHub的倉庫?
我在下面嘗試查詢並收到404:
curl -i -H "Authorization: token <token>" https://github.mycompany.com/api/v3/search/code?q=class
由於我嘗試了curl -u <userName>
和
當前,Search API仍在GitHub Enterprise上預覽。 因此,您需要在Accept標頭中指定一種特殊的媒體類型,以使一切正常。
試試看:
curl -i -H "Accept: application/vnd.github.preview+json" -H "Authorization: token <token>" https://github.mycompany.com/api/v3/search/code?q=class
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.