All of lore.kernel.org
 help / color / mirror / Atom feed
* HOWTO set up a repository which can be pushed into over HTTP
@ 2006-08-04 18:38 Johannes Schindelin
  2006-08-04 19:12 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2006-08-04 18:38 UTC (permalink / raw)
  To: git

Hi,

I set up such a repository twice now, and it is not exactly 
straight-forward. So, maybe some people find this useful:

This text assumes that you

- have an Apache webserver,
- can edit the configuration of it,
- can restart it, and
- have permissions to chown a directory

Step 1: setup a bare repository
-------------------------------

Create the directory (this assumes you have your Apache installed in
/usr/local/apache2):

	$ cd /usr/local/apache/htdocs
	$ mkdir my-new-repo.git

Initialize a bare repository

	$ cd my-new-repo.git
	$ git --bare init-db

Change the ownership to your webserver's credentials

	$ chown -R www.www .

If you do not know which user Apache runs as, you can alternatively do a 
"chmod -R a+w .", inspect the files which are created later on, and set 
the permissions appropriately.

Step 2: enable DAV on this repository
-------------------------------------

In your httpd.conf, make sure that this line exists:

	DAVLockDB "/usr/local/apache2/temp/DAV.lock"

Of course, it can point somewhere else, but the string is actually just a 
prefix in some Apache configurations, and therefore the _directory_ has to 
be writable by the user Apache runs as.

Then, add something like this to your httpd.conf

	<Location /my-new-repo.git>
		DAV on
		AuthType Basic
		AuthName "Git"
		AuthUserFile /usr/local/apache2/conf/passwd.git
		Require valid-user
	</Location>

The password file can be somewhere else, but it has to be readable by 
Apache.

You can create this file by

	$ htpasswd -c /usr/local/apache2/conf/passwd.git <user>

you will be asked a password, and the file is created. Subsequent calls
to htpasswd should omit the '-c' option, since you want to append to the
existing file.

You need to restart Apache; 'apachectl --graceful' is sufficient.

Step 3: setup the client
------------------------

Make sure that you have HTTP support, i.e. your git was built with curl.
The easiest way to check is to look for the executable 'git-http-push'.

Then, add the following to your .netrc (you can do without, but will be
asked to input your password a _lot_ of times):

	machine <servername>
	login <username>
	password <password>

If you want to access the webserver by its IP, you have to type that in,
instead of the server name.

Now, add the remote in your existing repository which contains the project
you want to export:

	$ git-repo-config remote.upload.url \
		http://<username>@<servername>/my-new-repo.git/

It is important to put the last '/'; Without it, the server will send
a redirect which git-http-push does not (yet) understand, and git-http-push
will repeat the request inifinitely.

Step 4: make the initial push
-----------------------------

>From your client repository, do

	$ git-http-push upload master

(This assumes that the branch you want to export is called 'master' in your
client setup...)

Troubleshooting:
----------------

If git-http-push says

	Error: no DAV locking support on remote repo http://...

then it means the webserver did not accept your authentication. Make sure
that the user name and password matches in httpd.conf, .netrc and the URL
you are uploading to.

If git-http-push shows you an error (22/502) when trying to MOVE a blob,
it means that your webserver somehow does not recognize its name in the
request; This can happen when you start Apache, but then disable the
network interface. A simple restart of Apache helps.

In other cases, reading /usr/local/apache2/logs/error_log is often helpful.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-08-09 20:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-04 18:38 HOWTO set up a repository which can be pushed into over HTTP Johannes Schindelin
2006-08-04 19:12 ` Junio C Hamano
2006-08-04 22:45   ` Johannes Schindelin
2006-08-07  7:55     ` Junio C Hamano
2006-08-08 19:02       ` Rutger Nijlunsing
2006-08-08 23:11         ` Johannes Schindelin
2006-08-09 19:31           ` Rutger Nijlunsing
2006-08-09 20:20             ` Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.