簡體   English   中英

如何在私有組織中使用GitHub 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>

  • 如果輸入錯誤的密碼,則會收到驗證錯誤。
  • 如果我輸入正確的密碼,密碼會通過驗證,但會返回404以進行搜索查詢。

當前,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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM