这两天公司gitlab服务器出现故障,使用备份紧急恢复以后发现部分项目访问http 500的报错,记得之前迁移和升级的时候也遇到过这样问题,这次把解决方法写到本地。


原文:

https://gitlab.com/gitlab-org/gitlab-ce/issues/17873

 

报错

==> /var/log/gitlab/gitlab-rails/production.log <==

Started POST "/api/v3/internal/allowed" for 127.0.0.1 at 2017-06-26 14:32:41 +0800

Started GET "/nginxs/blog" for 19.92.19.162 at 2017-06-26 14:32:42 +0800

Processing by ProjectsController#show as HTML

  Parameters: {"namespace_id"=>"nginxs", "id"=>"blog"}

Completed 500 Internal Server Error in 374ms (ActiveRecord: 21.2ms)

 

OpenSSL::Cipher::CipherError (bad decrypt):

  app/models/project.rb:456:in `import_url'

  app/models/project.rb:486:in `external_import?'

  app/models/project.rb:478:in `import?'

  app/models/project.rb:494:in `import_in_progress?'

  app/controllers/projects_controller.rb:93:in `show'

  lib/gitlab/middleware/go.rb:16:in `call'

 

 解决方法:

执行下面命令既可恢复

[root@git ~]#gitlab-rails runner  "Project.where.not(import_url: nil).each { |p| p.import_data.destroy if p.import_data }"