Is there anyway to programmatically fetch a zipball of private github repo?

后端 未结 5 423
伪装坚强ぢ
伪装坚强ぢ 2020-12-24 06:10

We got a necessity to fetch a zipball of a private repo. For public ones it\'s pretty easy either through GitHub API or manually (https://github.com/user/repo/zipball/ma

5条回答
  •  清歌不尽
    2020-12-24 06:32

    Edit: This no longer works.


    with CURL:

    curl -L -F "login=$USER" -F "token=$TOKEN" https://github.com/$USER/$REPO/$PKGTYPE/$BRANCHorTAG
    

    where $TOKEN is the API token on your github profile, not an oAuth2 token used for communicating with the APIv3.

    $USER is the user account the token is connected with, not necessarily the organization/other user the repo belongs to. Second Instance of $USER is the user/account the repo is.

    $REPO is the name of the private repository

    $PKGTYPE is tarball or zipball and $BRANCHorTAG is a branch, like master, or a tag name for a commit.

    The first instance of $USER must have access to the repo belonging to the second instance of $USER.

    I could not find this documented ANYWHERE, so I also have a little write up about it if you want anything more detailed.

提交回复
热议问题