Cranio
Cranio

Reputation: 9847

Publishing a remote GIT repository on the same server

Sorry for the dumb question, but I haven't managed to understand how. I have a local repo and a remote repo on the server, both are Ubuntu. I'ts all okay, commits work over SSH, but how do I force the remote server into publishing the repo into /var/www ?

Upvotes: 1

Views: 63

Answers (1)

Cranio
Cranio

Reputation: 9847

This is how I solved the problem:

  1. I configured the local repository

  2. I created a bare repository on the remote server

    git init --bare

  3. I've taken the necessary steps to configure committing to the remote repo

  4. I added a post-receive hook under the hooks folder of my remote repository

/path/to/repo/hooks/post-receive:

#!/bin/sh
GIT_WORK_TREE=/var/www/www.example.org git checkout -f

Then I chmod-ded it:

chmod +x /path/to/repo/hooks/post-receive

Upvotes: 4

Related Questions