apache - How to set up git over http? -
i need set git server git-over-http (smart http), resources available online mess, mixing in other apache configuration, missing details or not beingness explicit enough.
i answering question myself based on found lacking in available resources.
first necessary understand there 2 components git-over-http: git , apache. these 2 connected through script name of git-http-backend. challenge configure interface between these 2 components, http requests git forwarded apache.
note: security outside scope of guide.
start out installing git , apache2 using bundle manager of distribution.
add modules needed apache enable git-over-http. these cgi, alias , env
$ a2enmod cgi alias env
copy next /etc/apache2/httpd.conf (without removing whatever else contains)
<virtualhost *:80> setenv git_project_root /data/git setenv git_http_export_all setenv remote_user=$redirect_remote_user scriptaliasmatch \ "(?x)^/(.*/(head | \ info/refs | \ objects/(info/[^/]+ | \ [0-9a-f]{2}/[0-9a-f]{38} | \ pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ git-(upload|receive)-pack))$" \ "/usr/lib/git/git-http-backend/$1" alias /git /data/git <directory /usr/lib/git> options +execcgi -multiviews +symlinksifownermatch allowoverride none order allow,deny allow </directory> </virtualhost>
now replace 2 occurrences of /data/git parent directory of git repos on server (don't worry if don't have repos yet, utilize directory intend place it/them)
also replace /usr/lib/git/git-http-backend location of git-http-backend on system, can found using $ find / -name git-http-backend
it may on scheme redirect_remote_user overwrites valid remote_user. if setup doesn't work when finished, seek removing line.
according this source, may necessary replace lastly 2 lines within directory tag require granted
for apache 2.4 , above.
$ apache2ctl -k graceful
now apache server set up, we're not done yet, there of import parts of setting repos impact whether setup works or not.
set repo: $ mkdir myrepo.git $ cd myrepo.git $ git init --bare --shared $ cp hooks/post-update.sample hooks/post-update $ git update-server-info $ chown -r wwwrun:www
here of import understand lastly line changes owner of repo apache2 user. user may different on system. find apache user, execute $ ps aux | egrep '(apache|httpd)'
. find grouping name of user, execute $ id user-name
. on scheme user wwwrun , grouping www. replace accordingly.
in order utilize repo, need know url. setup url http://server.domain/myrepo.git
note: https not work.
when accessing repo client, add together remote:
$ git remote add together origin http://server.domain/myrepo.git
then can interact other git repo.
git apache http
No comments:
Post a Comment