How to automate git to automatically clone repo on server?

I have a repo in which I want to push changes. I want to synchronize two repositories: ./ pages.git in. / pages. My git installation on my development machine is inserted into pages.git. But the web application works with. / pages.

git clone pages.git pages
fatal: destination path 'pages' already exists and is not an empty directory.

Well, now I delete the page directory and git works. But this is not a clean decision, is it?

Is there a way to do this without manually deleting the page directory? I would like to automate this process so that git will automatically execute actions whenever I click.

Best, Marius

+3
source share
2 answers

post-receive hook pages.git, git pull pages, ? git clone (, , ), git pull , .

- , , :

cd /var/repos/path_to_mirror || exit
unset GIT_DIR
git pull origin master
  • path_to_mirror pages .
  • script pages.git/.git/hooks/post-receive.
+4

local, pages.git webapp?

, post-receive pages.git, git pull pages pages.

Post-receive . , ref - push.

0

Source: https://habr.com/ru/post/1734867/


All Articles