#3845 Allow anonymous cloning if gitolite is in use
Closed 5 years ago by puiterwijk. Opened 5 years ago by puiterwijk.
puiterwijk/pagure anongitolite  into  master

file modified
+9
@@ -1467,6 +1467,15 @@ 

  Defaults to: ``True``

  

  

+ ANON_HTTP_PULL_USER

+ ~~~~~~~~~~~~~~~~~~~

+ 

+ This configures a username used to pass gitolite as anonymous user for HTTP cloning.

+ If unset, anonymous cloning won't work via HTTPS.

+ 

+ Defaults to: ``None``

+ 

+ 

  ALLOW_HTTP_PUSH

  ~~~~~~~~~~~~~~~

  

@@ -483,6 +483,8 @@ 

  # HTTP pull/push options

  # Whether to allow Git HTTP proxying

  ALLOW_HTTP_PULL_PUSH = True

+ # Anonymous HTTP pull user. Should be a reserved user.

+ ANON_HTTP_PULL_USER = None

  # Whether to allow pushing via HTTP

  ALLOW_HTTP_PUSH = False

  # Path to Gitolite-shell if using that, None to use Git directly

file modified
+5 -1
@@ -41,9 +41,12 @@ 

      """

      # We are going to shell out to gitolite-shell. Prepare the env it needs.

      gitenv = {

+         # Let's also provide PATH

+         "PATH": os.environ.get("PATH"),

          # These are the vars git-http-backend needs

          "PATH_INFO": flask.request.path,

-         "REMOTE_USER": flask.request.remote_user,

+         "REMOTE_USER": flask.request.remote_user

+         or pagure_config["ANON_HTTP_PULL_USER"],

          "REMOTE_ADDR": flask.request.remote_addr,

          "CONTENT_TYPE": flask.request.content_type,

          "QUERY_STRING": flask.request.query_string,
@@ -77,6 +80,7 @@ 

          "CONTENT_TYPE",

          "QUERY_STRING",

          "PYTHONPATH",

+         "PATH",

      ):

          if not gitenv[key]:

              del gitenv[key]

Wait, why do we need this? Doesn't this already work now?

It will work if you set the HTTP_ANON_USER in gitolite, this was intended as a workaround to that. But I'l retract this, and we can keep things as they were.

Pull-Request has been closed by puiterwijk

5 years ago