gitlab通过命令行获取特定分支的tar [英] gitlab get tar of a specific branch via command line

查看:1200
本文介绍了gitlab通过命令行获取特定分支的tar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用gitlab。当我进入界面,在每个分支,我可以下载源代码作为zip,tar或任何其他。

I'm using gitlab. When I go into the interface, on each branch I can download the source code as a zip, tar or whatsoever.

我正在做rpm规范文件,我需要使用命令行下载tar球的可能性。因为我添加了我的rsa键我可以做git克隆没有问题:

I am making rpm spec files for which I would need the possibility to download the tar ball using command line. since I added my rsa key i can do git clone without problems:

git clone http://gitlab/group/project.git
Cloning into 'project'...
remote: Counting objects: 1885, done.
remote: Compressing objects: 100% (826/826), done.
remote: Total 1885 (delta 1194), reused 1496 (delta 954)
Receiving objects: 100% (1885/1885), 1.30 MiB | 0 bytes/s, done.
Resolving deltas: 100% (1194/1194), done.
Checking connectivity... done

但是

wget http://gitlab/group/project/repository/archive.zip

得到我这些错误:

Resolving gitlab (gitlab)... 10.1.253.75
Connecting to gitlab (gitlab)|10.1.253.75|:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.


推荐答案

由于 GitLab 6.2 issue 5253 ,应该是:

GET /projects/:id/repository/archive

但是这似乎只供内部使用,因为你不能知道项目的id作为用户

But that seems for internal use only, since you cannot know the id of a project as a user (only its name).

别忘了, 显示在ability.rb 中,下载档案与权限相关联。确保您为您的项目设置了 download_code 权限。

这里必须是权限问题,因为,例如:

Here, it must be a permission issue, because, for instance:

wget http://demo.gitlab.com/gitlab/gitlab-recipes/repository/archive.zip

这样工作正常,并获得该项目的内容没有任何问题。

That works just fine, and get the content of that project without any issue.

但是,由于 OP Chris Maes 评论,并在问题6645 中提及,如 app / models / ability.rb

However, as the OP Chris Maes comments and mentions in issue 6645, as as illustrated by app/models/ability.rb:

 if project && project.public?

... dowload_code 功能对于公共项目只有

... that "dowload_code" feature is only for public projects.

这篇关于gitlab通过命令行获取特定分支的tar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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