C# example of downloading GitHub private repo programmatically

前端 未结 4 1130
广开言路
广开言路 2020-12-16 17:10

I see that the download path for a GitHub repo is of the form

https://github.com/{username}/{reponame}/archive/{branchname}.zip

For a priva

4条回答
  •  渐次进展
    2020-12-16 17:44

    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.

提交回复
热议问题