OSDN Git Service

Fix HTTP push to public repos
authorThomas Guyot-Sionnest <Thomas.Guyot-Sionnest@nuance.com>
Wed, 4 Dec 2013 23:07:14 +0000 (18:07 -0500)
committerThomas Guyot-Sionnest <Thomas.Guyot-Sionnest@nuance.com>
Mon, 16 Dec 2013 17:39:54 +0000 (12:39 -0500)
When doing an HTTP push, git (as of v1.7.9) first do an info/refs
request, and only if this request requires authentication it asks the
user for its password and authenticates further requests.

The initial request normally clears without auth on public repos as it
doesn't update any ref. This patch forces every git-receive-pack
requests to provide authentication.

lib/gitlab/backend/grack_auth.rb

index c629144..60c03ce 100644 (file)
@@ -92,6 +92,9 @@ module Grack
           return false unless can?(user, action, project)
         end
 
+        # Never let git-receive-pack trough unauthenticated; it's
+        # harmless but git < 1.8 doesn't like it
+        return false if user.nil?
         true
       else
         false