我能够让它为 github 企业工作,感谢上面的建议。不得不接受你所有的建议并尝试,最后我能够让它发挥作用。这些是我为使其工作而遵循的步骤。
- 创建个人令牌,遵循以下步骤:
https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
确保您对令牌具有最低以下权限:
- 回购(在回购下全选)
- admin:org -> read:org(在“admin:org”下选择“read:org”)
使用以下 curl 命令获取内容:
curl -H "Authorization: token [yourPersonalToken]" -H "Accept: application/vnd.github.v3.raw" -o [filePath]-content.json -L https://github.[company].com/api/v3/repos/[ORG]/[REPO_NAME]/contents/[PATH_TO_FILE]/content.json?ref=[BRANCH_NAME]
哪里->
[yourPersonalToken] is the token you created.
[filePath] is a path where you want to save the downloaded copy.
[company] is the name of company which hosted the github enterprise.
[ORG] is the github organization is which repo is created.
[REPO_NAME] is the name of the repository.
[PATH_TO_FILE] is the path where file is located.
[BRANCH_NAME] is the name of the branch you want to use, e.g. master, develop etc.
例子:
curl -H "Authorization: token 5a86ecda9ff927baaa66fad2af5bee8" -H "Accept: application/vnd.github.v3.raw" -o C:\Downloads\manifest.json -L https://github.example.com/api/v3/repos/cms/cms_one/contents/app/data/manifest.json?ref=master