I want to synchronize a directory /home/myproject of my distant machine with, as source, the directory D:\myproject\ of my local machine. I would like to use git (to also benefit from commits history, etc.)
I did this on distant machine (creation of a bare repository, see also What is the difference between "git init" and "git init --bare"?):
mkdir /home/myproject.git
cd /home/myproject.git
git init --bare
and this on local machine (with current directory D:\myproject\):
git init
git add main.py # D:\myproject\main.py exists on local machine
git commit -m "First"
git remote add dest root@203.0.113.0:/home/myproject.git # via ssh
git push dest master
It works, now distant server's /home/myproject.git is synchronized, but the directory /home/myproject/ (that should contain for example /home/myproject/main.py) still doesn't exist!
So I have to do this on the distant server:
cd /home
git clone myproject.git myproject
and now /home/myproject/main.py exists.
Problem: each time I do git push on local machine, it's distant server's /home/myproject.git which is updated, and not /home/myproject/.
Question: how to configure these repositories such that git push automatically updates all the files in /home/myproject such as /home/myproject/main.py, instead of only /home/myproject.git?