Tutorial after tutorial on setting up a git repo on your server are essentially all the same -- and they go like this:
- Install git on your server
- Create
git/project.git
off your root directory of your server - Initialize
git/project.git
usinggit init --bare
- In
git/project.git/hooks
thentouch post-receive
- Add to post-receive:
#!/bin/bash\n 2 GIT_WORK_TREE=/path/to/your/vc'd/project git checkout -f
- Then make post-recieve executable:
chmod +x post-receive
- Back on your local machine,
git clone ssh://user@host.com/git/project.git
- And add files, commit and push
This is all fine, and I can indeed push to the git/project.git
and end up with those files in the path/to/your/vc'd/project
but I'm looking to understand...
Why use the hook at all?
It leaves you without the ability to pull your path/to/your/vc'd/project/
on your local machine.
Why not just git init
the path/to/your/vc'd/project
and clone
it on your local machine?
Further, if anyone could explain how to get git pull
functionality on the local side for the path/to/your/vc'd/project
with this hooking method, it would be much appreciated
Thanks :)