I read an article on setting up deployment via git push to your server.
I found it ugly how they had two directories
project.git (git dir) and
project (work tree).
First I tried pushing to a normal repo, which diden't work except with an ugly workaround.
Then I realized I could do what the article said, but with
project/.git being the bare repo
# full path to project P=$HOME/project # git will create needed directories git init --bare $P/.git cat <<EOF > $P/.git/hooks/post-receive #!/bin/sh git --work-tree=$P checkout main --force EOF chmod +x $P/.git/hooks/post-receive
On dev machine
git remote add server ssh://[email protected]/full/path/to/project/.git git push server