Chris Pillen
Chris Pillen

Reputation: 828

How can I mirror a bare repo to a working repo - both on the server?

I really am a git-noob - sorry...

I have a bare repository in server/app.git. I have access via ssh.

I want this as supposed as the sharing point for my friends to work on the project.

But I would like to have the master branch somehow mirrored to server/app as an working copy to deliver via http.

Is that possible? I guess so.

Upvotes: 0

Views: 67

Answers (1)

phd
phd

Reputation: 95028

You need a post-receive or post-update hook on the server side. Example:

In the server/app.git repository create a post-receive hook: edit .git/hooks/post-receive and put the following into it (adapt the path to your directory):

git --work-tree=../app checkout -f

Make the hook executable:

chmod +x .git/hooks/post-receive

Now on every push to that repo git will run the hook and the hook will update ../app directory with the content checked out of the branch.

See http://toroid.org/git-website-howto

Upvotes: 1

Related Questions