ericpaulbishop / redmine_git_hosting

A ChiliProject/Redmine plugin which makes configuring your own git hosting easy.
186 stars 37 forks source link

Smart HTTP not woking #95

Closed ramzeska closed 13 years ago

ramzeska commented 13 years ago

I cannot get smart http working.

I use apache 2 with ruby enterprise and passenger on debian 6 amd64. my apache config is:

<VirtualHost *:80>
    DocumentRoot /var/www/redmine/public
    Passheader Authorization

    LogLevel warn
    ErrorLog /var/log/apache2/redmine_error
    CustomLog /var/log/apache2/redmine_access combined
        <Directory "/var/www/redmine/public">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
    </Directory>

        <Location /sys>
    Order deny,allow
        Allow from 127.0.0.1
        Deny from all
        </Location>
    <Location />
        Dav ON
    </Location>
</VirtualHost>

production.log


Processing GitHttpController#index (for 192.168.1.165 at 2011-10-03 01:59:04) [GET]
  Parameters: {"p1"=>"info", "p2"=>"refs", "p3"=>"", "service"=>"git-receive-pack", "action"=>"index", "id"=>"test", "path"=>"test.git", "controller"=>"git_http"}
Redirected to http://192.168.1.185/login?back_url=http%3A%2F%2F192.168.1.185%2Ftest.git%2Finfo%2Frefs%2F%3Fservice%3Dgit-receive-pack
Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 2ms (DB: 0) | 302 Found [http://192.168.1.185/test.git/info/refs?service=git-receive-pack]

Processing AccountController#login (for 192.168.1.165 at 2011-10-03 01:59:05) [GET]
  Parameters: {"back_url"=>"http://192.168.1.185/test.git/info/refs/?service=git-receive-pack", "action"=>"login", "controller"=>"account"}
Rendering template within layouts/base
Rendering account/login
Completed in 8ms (View: 5, DB: 2) | 200 OK [http://192.168.1.185/login?back_url=http%3A%2F%2F192.168.1.185%2Ftest.git%2Finfo%2Frefs%2F%3Fservice%3Dgit-receive-pack]

So problem is definitely in authentication. As you say in readme, there are no need to set up any configuration. If i first login in browser then go to http://192.168.1.185/test.git/info/refs/ or http://192.168.1.185/test.git/info/refs/?service=git-receive-pack it works ok.

thx.

ericpaulbishop commented 13 years ago

Did you enable smart http for both http and https in the repository settings page? What exactly are you seeing on the command line when you try to clone the repo via smart http?

ramzeska commented 13 years ago

Yes, both enabled, i can't enable only http, i can choose https only or https+http or off.

error:

error: Cannot access URL http://admin@192.168.1.185/test.git/, return code 22
fatal: git-http-push failed
ericpaulbishop commented 13 years ago

What version of git are you using (git --version) ?

Also, were you prompted for a password? I don't see that in your output.

ramzeska commented 13 years ago

i tryed this:

git version 1.7.4.4 git version 1.7.2.3

git push -u http master
Password: 
Password: 
error: Cannot access URL http://admin@192.168.1.185/test.git/, return code 22
fatal: git-http-push failed
ericpaulbishop commented 13 years ago

You're sure user admin has manager or developer permissions for the test project?

ramzeska commented 13 years ago

Yes, of course, user have manager and developer and also admin right.

ramzeska commented 13 years ago

I have some new information, quite cool btw,

I unchecked the Authentication required check box (Administration -> Settings -> Authentication ) then it start working, but bad side, that if project are public then anybody can clone it, so everyone have read only permissions.

So the problem that if auth check box set on, then nothing work.

I cannot set this box off, we use redmine privatly in our company, without public at all, even registration.

P.S. btw at now, there are no need installing mod_fcgid add "Passheader Authorization" into the virtual host configuration file at all.

ericpaulbishop commented 13 years ago

Ah... that allowed me to reproduce and fix the problem. Should be working now

Thanks for bringing this to my attention and digging a little deeper to find the setting that was triggering the issue.