Hell0 Hell0 - 1 month ago 11
Git Question

git push isn't syncing worktree directory

I'm working on a locale repository

$HOME/some_git_repo

Now, i must do
git checkout
on the server side, everytime i need to push anything updated. (i can handle that).

The problem is that isn't synchronizing anything in the
/var/www/some_git_repo
, on the server side (remote).
That means the
hooks/post_receive
script isn't doing their work

scope:

# post-receive -- script
git --work-tree='/var/www/some_git_repo' --git-dir='/var/repo/some_git_repo.git'

Answer

Well, this response is not the preferible solution, but it resolve the problem, by updating the working-tree with a simple executable script:

rsync -arv --exclude=something_tobe_excluded \
  --progress repo_source-dir working_tree

Every file/directory_path, must be specified as a single argument. (on the exclude variable).