diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb index 79a7e61e3fe89670cb8fa786af498f5279ec3bd6..f124333bd5bd9ea207e9082514616030be667588 100644 --- a/app/controllers/projects/git_http_controller.rb +++ b/app/controllers/projects/git_http_controller.rb @@ -162,12 +162,18 @@ class Projects::GitHttpController < Projects::ApplicationController return false unless Gitlab.config.gitlab_shell.upload_pack if user - Gitlab::GitAccess.new(user, project, 'http').download_access_check.allowed? + access.allowed? else ci? || project.public? end end + def access + return @access if defined?(@access) + + @access = Gitlab::GitAccess.new(user, project, 'http').check('git-upload-pack') + end + def receive_pack_allowed? return false unless Gitlab.config.gitlab_shell.receive_pack