403 Forbidden for git repository over http

1,143 views
Skip to first unread message

Amit Agrawal

unread,
Aug 23, 2016, 10:02:20 AM8/23/16
to git-for-windows
Hi All,
I am trying to setup a central Git server which can be accessed over HTTP
protocol.
I have installed Bitnami WAMP stack with Apache 2.4 version.  The Git
repository is located in C:\Git\Repos.
In httpd.conf file, I have changed the Document Root folder to C:\Git\Repos

   DocumentRoot "C:\Git\Repos"
   <Directory "C:\Git\Repos">
       Options All
       AllowOverride All
       Require all granted
   </Directory>

There are not .httpaccess file in C:\Git\Repos so 'AllowOverride All' has
no effect, I could have kept it None as well. To begin with, I am just
trying to serve git repository over http and hence I have allowed access to
everybody.
The Env variable for Git has been set and all GET request ending with /git/
is redirected to git-http-backend.

   SetEnv GIT_PROJECT_ROOT "C:\Git\Repos"
   SetEnv GIT_HTTP_EXPORT_ALL
   ScriptAlias /git/ "C:/Program
   Files/Git/mingw64/libexec/git-core/git-http-backend/"

However, I get 403 Forbidden error when I try to clone the repository like
this
   C:\test>git clone http://localhost:80/git/Projects/example
   Cloning into 'example'...
   fatal: unable to access 'http://localhost:80/git/Projects/example/': The
   requested URL returned error: 403

. Following is the error in access log
   ::1 - - [22/Aug/2016:16:44:54 +0530] "GET /git/ HTTP/1.1" 403 213

Error in Error Log
   [client ::1:64266] AH01630: client denied by server configuration:
   C:/Program Files/Git/mingw64/libexec/git-core/git-http-backend

So it looks like git-http-backend is not allowing this access. As per the
documentation, it concatenates environment variables PATH_INFO with
GIT_PROJECT_ROOT which seems be correctly set. I also tried "AcceptPathInfo
On" but that didn't help.


I have been reading and trying lots of things  like the ones mentioned
below including searching this forum to any solution to this but still in
vain.
   https://docs.moodle.org/31/en/Manual_install_on_Windows_7_with_Apache_and_MySQL#Step_4:_Configure_Apache_and_PHP
   https://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html
   http://www.parallelsymmetry.com/howto/git.jsp

I have tried to give location access to /git/ path but that didn't help
   <LocationMatch "^/git/">
           AuthType Basic
           AuthName "Git Access"
           Require all granted
   </LocationMatch>
Also for all fetch requests

   <LocationMatch "^/git/.*/git-receive-pack$">
           AuthType Basic
           AuthName "Git Access"
           Require group committers
           ...
   </LocationMatch>

I also given Read/write access to C:\Git\Repos to ALL users in the system.
I am using Windows Server 2012 R2.

I have a feeling that either some of the above configuration is wrong OR
git-http-backend is expecting something which I have not set.

I have been trying to setup the access for last few days and above are just
few of things that I tried. Kindly help.

Regards,
Amit

Amit Agrawal

unread,
Aug 23, 2016, 10:02:20 AM8/23/16
to git-for-windows

I have tried to give location access to /git/ path but that didn't help
   <LocationMatch "^/git/">
           AuthType Basic
           AuthName "Git Access"
           Require all granted
   </LocationMatch>
Also for all fetch requests

   <LocationMatch "^/git/.*/git-receive-pack$">
           AuthType Basic
           AuthName "Git Access"
           Require group committers
           ...
   </LocationMatch>

I also given Read/write access to C:\Git\Repos to ALL users in the system.
I am using Windows Server 2012 R2.

I have a feeling that either some of the above configuration is wrong OR
git-http-backend is expecting something which I have not set.

I have been trying to setup the access for last few days and above are just
few of things that I tried. Kindly help.

Please don't remove this post as I searched the forum already and didn't
come across any similar post with solution.

Regards,
Amit

Dirk Heinrichs

unread,
Aug 24, 2016, 1:25:16 AM8/24/16
to git-for...@googlegroups.com
Am 23.08.2016 um 13:32 schrieb Amit Agrawal:

I am trying to setup a central Git server which can be accessed over HTTP protocol. I have installed Bitnami WAMP stack with Apache 2.4 version.

Not strictly a GfW question, is it? Anyway, did you look into SCMManager or Go Git Service? Both are much simpler to set up.

HTH...

    Dirk
--
Dirk Heinrichs | Senior Systems Engineer, Delivery Pipeline
http://mimage.opentext.com/alt_content/binary/images/email-signature/recommind-ot.png
Tel: +49 2226 159666 (Ansage) 1149
Email: dirk.he...@recommind.com
Skype: dirk.heinrichs.recommind

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB 10646

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

Dirk Heinrichs

unread,
Aug 24, 2016, 1:30:20 AM8/24/16
to git-for...@googlegroups.com
Am 24.08.2016 um 07:25 schrieb Dirk Heinrichs:
Am 23.08.2016 um 13:32 schrieb Amit Agrawal:

I am trying to setup a central Git server which can be accessed over HTTP protocol. I have installed Bitnami WAMP stack with Apache 2.4 version.

Not strictly a GfW question, is it? Anyway, did you look into SCMManager or Go Git Service? Both are much simpler to set up.

Oh, and btw., although both should also run on Windows, you'd really better do this on Linux (even if most of your client systems are Windows).

Bye...
Reply all
Reply to author
Forward
0 new messages