gitlab 通过命令行获取特定分支的 tar [英] gitlab get tar of a specific branch via command line
问题描述
我正在使用 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 clone:
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,应该是:
Since GitLab 6.2 and issue 5253, it should be:
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
"权限.
Don't forget, as shown in ability.rb
, that downloading an archive is linked to a permission. Make sure you have that "download_code
" permission set for your project.
这里肯定是权限问题,因为例如:
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 评论和issue 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屋!