Ruby 通过 Gitlab 接口 如何打包下载版本库源码

return · December 20, 2016 · Last by zml replied at July 10, 2019 · 2130 hits

gitlab archive 接口如下:

# Get an archive of the repository
# @param [Integer] project the ID fo a project.
# sha (optional) - The commit SHA to download defaults to the tip of the default branch
# @return [Gitlab::ObjectifiedHash]
def project_archive(project, sha)
  get("/projects/#{project}/repository/archive?sha=#{sha}")
end
alias_method :repo_project_archive, :project_archive

调用 archive 接口后,返回 [Gitlab::ObjectifiedHash] 类型,而我想直接 send file,有好的解决方法吗? 当然,如果使用:https://git.aaaaa.net/api/v3/projects/1/repository/archive?&private_token=XXXXXXXXXX 这样是可以直接下载,但是会暴漏 token 值

谢谢大家

怎么解决的

You need to Sign in before reply, if you don't have an account, please Sign up first.