Download a GitLab private repository

前端 未结 5 867
北恋
北恋 2020-12-14 02:50

I want to use curl to download my private repo in GitLab. I know I can use the Gitlab API, but for some reason, It doesn\'t work.

Is this possible? When

5条回答
  •  余生分开走
    2020-12-14 03:10

    You can, but you need to authenticate yourself (as in "Gitlab API: How to generate the private token")

    curl http://gitlab.server/api/v3/session --data 'login=myUser&password=myPass'
    

    Then with the private token:

    curl --header "PRIVATE-TOKEN: QVy1PB7sTxfy4pqfZM1U" "http://example.com/api/v3/projects"
    

    Or, in your case, get the repository files:

    GET /projects/:id/repository/files
    

    Or, download directly one file.

提交回复
热议问题