0

I'm a newbie in git. After I finish messing with the versions and stuff, how can I deploy my final version to the /var/www/html directory? I cloned the repo, but there is probably a better way of doing it. Thanks!

I'd like to update /var/www/html (i.e what the end user sees) whenever I push updates to /user/my-repo.git

talhof9
  • 135
  • 3
  • 9
  • That doesn't seem to work. I have git repo on my remote server /user/my-repo.git. I'd like to update /var/www/html (i.e what the end user sees) whenever I push updates to /user/my-repo.git – talhof9 Mar 30 '13 at 10:03
  • have you tried some git hooks? you might find this instructive http://danbarber.me/using-git-for-deployment/ – Sébastien Dawans Mar 30 '13 at 10:20
  • @talhof9: You just put another git clone in /var/www/html. Then you can follow the exact instructions in the other question. – guerda Mar 30 '13 at 13:03
  • OK, I set up the .git in the /var/www/html directory. How can I protect it from being accessed from browser? Thanks for your help! – talhof9 Mar 30 '13 at 13:47
  • Here's an alternative method that seems quite good to me, and avoids the `.git` directory issue http://toroid.org/ams/git-website-howto . There is some information here about how to make the `.git` directory inaccessible from the web: http://stackoverflow.com/questions/6142437/make-git-directory-web-inaccessible – clstrfsck Mar 31 '13 at 00:29
  • It works finally, thank you very much! I combined your solutions – talhof9 Mar 31 '13 at 07:45
  • @talhof9: Glad you found a solution. If you can explain your solution in detail, please provide it as an answer and accept it. – guerda Apr 02 '13 at 08:32

1 Answers1

0

The idea of git is to do version control, to deploy you could use git archive to make a tarball/zip file. Or copy the relevant files directly.

vonbrand
  • 11,412
  • 8
  • 32
  • 52