Unable to push a directory over smart-http

5k views Asked by At

I've been going a this for two days in a row now, and I'm giving up on finding the solution all by myself. I am trying to set up Redmine on a server - that part went well. I am also trying to install a git repository, but although I've been able to clone and pull perfectly well via SSH, I'm having a rough time doing the same over HTTP.

First of all, here is the verbose git push error:

================================================================

$ GIT_CURL_VERBOSE=1 git push http://192.168.0.13/gitweb/Project master * Couldn't find host 192.168.0.13 in the _netrc file; using defaults * About to connect() to 192.168.0.13 port 80 (#0) * Trying 192.168.0.13... * 0x20ab4f0 is at send pipe head! * Connected to 192.168.0.13 (192.168.0.13) port 80 (#0)

GET /gitweb/Project/info/refs?service=git-receive-pack HTTP/1.1 User-Agent: git/1.7.4.3282.g844cb Host: 192.168.0.13 Accept: / Pragma: no-cache

  • The requested URL returned error: 403
  • Expire cleared
  • Closing connection #0
  • Couldn't find host 192.168.0.13 in the _netrc file; using defaults
  • About to connect() to 192.168.0.13 port 80 (#0)
  • Trying 192.168.0.13... * 0x20ab4f0 is at send pipe head!
  • Connected to 192.168.0.13 (192.168.0.13) port 80 (#0)

    GET /gitweb/Project/info/refs HTTP/1.1 User-Agent: git/1.7.4.3282.g844cb Host: 192.168.0.13 Accept: / Pragma: no-cache

  • The requested URL returned error: 403

  • Closing connection #0 error: The requested URL returned error: 403 while accessing http://192.168.0.13 /gitweb/Project/info/refs

fatal: HTTP request failed

================================================================

So there are obviously some misconfigured rights, eventhough I've temporarily chmodded my repository folder to 777.

I reckon you'll also be interested in apache's configuration:

================================================================

ServerAdmin webmaster@localhost

[...snip...]

PerlLoadModule Apache::Redmine
SetEnv GIT_PROJECT_ROOT /var/cache/git/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

<Location "/git/">
    DAV on
    AuthType Basic
    AuthName "Git Repository"
    Require valid-user

    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler

    RedmineDSN "DBI:mysql:database=redmine;host=localhost"
    RedmineDbUser "redmine" 
    RedmineDbPass "XXXXXXX" 
    RedmineGitSmartHttp yes
</Location>

Alias /gitweb/ "/var/cache/git/public/"
<Location "/gitweb/">
    Order deny,allow
    Deny from all
    <Limit GET PROPFIND OPTIONS REPORT>
       Options Indexes FollowSymLinks MultiViews
       Allow from 127.0.0.1
       Allow from localhost
    </Limit>
</Location>

================================================================

So if someone would be so kind as to give me a hint about what to do, I'd really be grateful. Thanks in advance!

2

There are 2 answers

0
executifs On BEST ANSWER

Okay, problem solved :) This is the tutorial to follow to the letter:

http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Redmine_for_advanced_git_integration

In my case, the final entry looks like:

PerlLoadModule Apache::Redmine

Alias /git/ "/var/cache/git/public/"
<Directory "/git/">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Location "/git/">
    DAV on
    AuthType Basic
    AuthName "My Git Repository"
    Require valid-user

    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler

    RedmineDSN "DBI:mysql:database=redmine;host=localhost"
    RedmineDbUser "redmine" 
    RedmineDbPass "XXXXXXX" 
    RedmineGitSmartHttp yes
</Location>
2
Arrowmaster On

You don't seem to be using any authentication. By default, git only allows pushing via smart-http when authentication is used.

You should be able to either add a username to the url you are using and it will prompt you for a password, or you can set the username and password in the _netrc file.