'how to download repository from Github where i'm not the owner

I'm trying to download a private repository as .zip via cmd, I can do pull/push and create branches on this repository but i'm not sure if that makes me a collaborator, i was able to achieve this with a public repository like this curl -L -o master.zip http://github.com/zoul/Finch/zipball/master/ I also tried curl -u 'MyUsername' -L -o master.zip https://github.com/{repo owner}/{repo name}/zipball/master/ but all I got was a .zip and the message "The archive is either in unknown format or damaged", what am I missing?



Solution 1:[1]

I found what I was looking for. I generated a personal access token in Github with all the necessary permissions (initially I didn't give all the permissions I needed) and with the following structure I was able to download the zip from the master branch:

curl -H "Authorization: token MyToken" -L -o master.zip https://github.com/repoOwner/repoName/zipball/master/

With the github API, I got information about it:

curl -i -H "Authorization: token MyToken" https://api.github.com/repos/repoOwner/repoName

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak