1

Im trying to have a shared remote repository where team members can push their changes and see them live in a staging environment.

Ive looked some options but I'm still stuck. Bare repositories have no working tree, and ive tried a normal repository with receive.denyCurrentBranch set to false, (which lets me push to the remote) but the working tree still doesnt get updated until you log into the server and do a git reset.

Ideally id like to be able to just push to the repository (one command) and see the changes updated live.

alex-e-leon
  • 335
  • 3
  • 12
  • this is not a good workflow for website deployment. Profer a bare repo with hooks. See http://ryanflorence.com/simple-git-deployment/ – CharlesB Jun 04 '12 at 08:35
  • 1
    Duplicate of [this one](http://stackoverflow.com/q/3838727/720999). The OP seemingly did not know about the necessity to use hooks in the remote repository so I'm hesitating to marking this question for closing as duplicate. – kostix Jun 04 '12 at 10:25
  • I didnt mention in the question because I didnt think it was relevant but I do have a bare repo (origin) in addition to the others. Thanks to everyone who pointed me in the right direction. – alex-e-leon Jun 05 '12 at 10:09

1 Answers1

2

You will need to set up a post-receive hook on the remote repository to pull the changes to the working tree. With a bare repository, you can git-archive the HEAD and extract the archive to a directory, instead of updating a working tree.

Reference: Git Hooks; git-archive

lanzz
  • 38,081
  • 8
  • 81
  • 91