下载一个GitLab私有存储库 [英] Download a GitLab private repository

查看:671
本文介绍了下载一个GitLab私有存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 curl 在GitLab中下载我的私人回购。我知道我可以使用Gitlab API,但出于某种原因,它不起作用。



这可能吗?当我尝试这样做时,它总是返回登录页面。 可能的,只需按照以下步骤操作即可:


  1. 首先,您必须创建一个个人访问令牌:


    1. 转至

    2. 点击创建个人访问令牌


    3. 页面将重新加载并保存您的新令牌。 确保将令牌保存在某处安全,您将无法再查看它。





  2. 现在您已拥有个人访问令牌让您的项目ID使用API​​:



  • 现在您可以调用:

    wget -O your_project.tar.gz https://gitlab.com/api/v3/projects/0000000/repository/archive?private_token=XXXXXXXXXXXXXXXXXXXX


  • 然后将您的项目下载为 .tar.gz 文件。


    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 I try to do it this way, it always returns the login page.

    解决方案

    This is possible, just follow these steps:

    1. First, you have to create a "Personal Access Token":

      1. Go to Your Profile > Settings > Access Tokens.
      2. Enter a name for your "Personal Access Token".
      3. Check "api Access the authenticated user's API"

      4. Click "Create personal access token"

      5. The page will reload and save your new token.
      6. Make sure you save the token somewhere safe, you won't be able to view it again.

    2. Now that you have your "Personal Access Token", you need to get your project id to use the API:

      1. Go to https://gitlab.com/api/v3/projects?private_token=XXXXXXXXXXXXXXXXXXXX (replace the Xs with your new token)
      2. Get your project's id from the json.

    3. Now you can call:

      wget -O your_project.tar.gz https://gitlab.com/api/v3/projects/0000000/repository/archive?private_token=XXXXXXXXXXXXXXXXXXXX

    And that'll download your project as a .tar.gz file.

    这篇关于下载一个GitLab私有存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆