Re: git push from client is not updating files on server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jerome Yanga <jerome.yanga@xxxxxxxxx> writes:

> The project in Apache's DocumentRoot was created using the following command:
>
> "cd /var/www/git
> git clone --bare <non-bare working directory> <project>.git"
>
> Hence, I believe that is is bare.  Besides, it does not have .git
> folder.  I assumed that when I did this that the non-bare directory
> will also be updated when a push is performed via http.
>
> My objective is that I would like the developers to be able to push
> via http and these pushes will need to be reflected on the non-bare
> working directory as these directories will be used for automated
> tests.

So that <non-bare working directory> above is what you want to be
updated when you update <project>.git?

More concretely, for example, you have say /srv/project/frotz and
/var/www/git/frotz.git directories on that server.  Perhaps the
project may have started in the former:

	mkdir -p /srv/project/frotz
        cd /srv/project/frotz
        git init
        ... populate with the sources ...
        git add ...
        git commit

and then cloned to the other one

	cd /var/www/git && git clone --bare /srv/project/frotz frotz.git

I'll assume that is more or less the set-up you have.

Now, it depends on how the push goes to the latter one (I do not
remember offhand if pushing over dumb http transport triggers
hooks), but in general, you would install a post-update hook (read
githooks manual page) in the latter repository, that gets triggered
when it receives a push.  The hook could do something like this:

	#!/bin/sh
        unset GIT_DIR
        cd /srv/project/frotz &&
        git pull --ff-only /var/www/git/frotz.git master &&
	: you can trigger automated test here if you want to &&
        make test

The above example goes to the repository with a working tree, pulls
the latest change from the repository the user pushed into, and then
runs the automated test.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]