空 zip 存档:找不到用于摘要的模板:项目/存储库/存档

Posted

技术标签:

【中文标题】空 zip 存档:找不到用于摘要的模板:项目/存储库/存档【英文标题】:Empty zip archive: Couldn't find template for digesting: projects/repositories/archive 【发布时间】:2020-01-22 17:08:10 【问题描述】:

我在自己的服务器上自托管了 gitlab-ee(无需许可证即可运行)。我正在使用现有的 nginx/passenger 安装,所以我按照here 的说明进行操作。我还使用 Let's encrypt 来生成我自己的证书,并且我已经将 nginx 配置为自动将 HTTP 重定向到 HTTPS。

安装通常运行良好,但我最近尝试将存储库下载为 zip 文件,但 zip 文件始终为空。根据另一个论坛帖子,我尝试安装 gitlab-workhorse,但这也没有解决问题。

查看 gitlab-rails/production.log 文件,我得到以下错误:

Started GET "/amrbekhit/repo-name/-/archive/master/repo-name-master.zip" for XX.XX.XX.XX at 2019-09-14 14:05:27 +0300
Processing by Projects::RepositoriesController#archive as ZIP
  Parameters: "namespace_id"=>"amrbekhit", "project_id"=>"repo-name", "id"=>"master/repo-name-master"
  Couldn't find template for digesting: projects/repositories/archive

关于问题可能是什么的任何想法?

网址如下所示:

https://gitlab.mysite.com/amrbekhit/repo-name/-/archive/master/hydra-takip-sistemi-master.zip

这是我的 nginx 配置:

upstream gitlab-workhorse 
  server unix://var/opt/gitlab/gitlab-workhorse/socket fail_timeout=0;


server 
        # HTTP to HTTPS redirect
        listen 80;
        listen [::]:80;

        server_name gitlab.mysite.com;
        rewrite ^ https://$server_name$request_uri permanent;



server 
  listen *:443 ssl;
  server_name gitlab.mysite.com;
  server_tokens off;
  root /opt/gitlab/embedded/service/gitlab-rails/public;

  ssl_certificate /etc/letsencrypt/live/gitlab.mysite.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/gitlab.mysite.com/privkey.pem;

  client_max_body_size 250m;

  access_log  /var/log/gitlab/nginx/gitlab_access.log;
  error_log   /var/log/gitlab/nginx/gitlab_error.log;

  # Ensure Passenger uses the bundled Ruby version
  passenger_ruby /opt/gitlab/embedded/bin/ruby;

  # Correct the $PATH variable to included packaged executables
  passenger_env_var PATH "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/usr/local/bin:/usr/bin:/bin";

  # Make sure Passenger runs as the correct user and group to
  # prevent permission issues
  passenger_user git;
  passenger_group git;

  # Enable Passenger & keep at least one instance running at all times
  passenger_enabled on;
  passenger_min_instances 1;

  location ~ ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ 
    # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
    error_page 418 = @gitlab-workhorse;
    return 418;
  

  location ~ ^/[\w\.-]+/[\w\.-]+/repository/archive 
    # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
    error_page 418 = @gitlab-workhorse;
    return 418;
  

  location ~ ^/api/v3/projects/.*/repository/archive 
    # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
    error_page 418 = @gitlab-workhorse;
    return 418;
  

  # Build artifacts should be submitted to this location
  location ~ ^/[\w\.-]+/[\w\.-]+/builds/download 
      client_max_body_size 0;
      # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
      error_page 418 = @gitlab-workhorse;
      return 418;
  

  # Build artifacts should be submitted to this location
  location ~ /ci/api/v1/builds/[0-9]+/artifacts 
      client_max_body_size 0;
      # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
      error_page 418 = @gitlab-workhorse;
      return 418;
  

  # Build artifacts should be submitted to this location
  location ~ /api/v4/jobs/[0-9]+/artifacts 
      client_max_body_size 0;
      # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
      error_page 418 = @gitlab-workhorse;
      return 418;
  


  # For protocol upgrades from HTTP/1.0 to HTTP/1.1 we need to provide Host header if its missing
  if ($http_host = "") 
  # use one of values defined in server_name
    set $http_host_with_default "gitlab.mysite.com";
  

  if ($http_host != "") 
    set $http_host_with_default $http_host;
  

  location @gitlab-workhorse 

    ## https://github.com/gitlabhq/gitlabhq/issues/694
    ## Some requests take more than 30 seconds.
    proxy_read_timeout      3600;
    proxy_connect_timeout   300;
    proxy_redirect          off;

    # Do not buffer Git HTTP responses
    proxy_buffering off;

    proxy_set_header    Host                $http_host_with_default;
    proxy_set_header    X-Real-IP           $remote_addr;
    proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto   $scheme;

    proxy_pass http://gitlab-workhorse;

    ## The following settings only work with NGINX 1.7.11 or newer
    #
    ## Pass chunked request bodies to gitlab-workhorse as-is
    # proxy_request_buffering off;
    # proxy_http_version 1.1;
  

  ## Enable gzip compression as per rails guide:
  ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
  ## WARNING: If you are using relative urls remove the block below
  ## See config/application.rb under "Relative url support" for the list of
  ## other files that need to be changed for relative url support
  location ~ ^/(assets)/ 
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    gzip_static on; # to serve pre-gzipped version
    expires max;
    add_header Cache-Control public;
  

  error_page 502 /502.html;

  # Certbot
  location /.well-known 
      root /var/www/certbot;
  

【问题讨论】:

【参考方案1】:

最后我弄明白了——我错误地使用了Using an existing Passenger/NGINX installation,而不是指Using a non-bundled web-server。现在设置工作正常。

【讨论】:

以上是关于空 zip 存档:找不到用于摘要的模板:项目/存储库/存档的主要内容,如果未能解决你的问题,请参考以下文章

在 Python 中从克隆的 GitHub 存储库创建 Zip 存档

Gradle在本地Maven存储库中找不到现有的依赖项

node.js 中的 Zip 存档

PHP 从 Zip 存档中读取

使用 REST API 上传到 Azure Blob 存储时,Zip 档案损坏

Ionic iOS 构建失败,找不到错误存档