从Node.js中的私有github存储库下载文件

时间:2020-04-02 11:03:31

标签: node.js curl github wget

我需要从nodeJS的私有github存储库中下载一个文件。有什么办法吗?

我尝试了wget和curl。他们非常适合公共存储库。但是我找不到从私有存储库下载的任何方法。

预先感谢

1 个答案:

答案 0 :(得分:0)

鉴于您有权访问该存储库,因此需要为此创建一个github令牌。

带有curl

的示例
curl --header 'Authorization: token <GH-TOKEN>' \
     --header 'Accept: application/vnd.github.v3.raw' \
     --remote-name \
     --location https://api.github.com/repos/owner/repo/contents/path
相关问题