0

Hi everyone, I'm a complete noob with git and I have some questions on setting up an environment.

I have an ubuntu linux server on which i have setup the following sites as vhosts:

www.mydomain : production environment
stage.mydomain : staging environment for client approval tests
dev.mydomain : development environment for testing new code

i also have MAMP setup locally as a local dev environment.

What I would like to be able to do is to use the www.mydomain as a repo, then clone to stage, from stage to dev and then from dev to local. I have done this sucessfully already.

When I am happy with my work on local, i add/commit files, then push back to the dev for server specific testing.

Now I have managed to do a remote push back to the dev.mydomain without errors, but when I check the files, I find these haven't been updated to include my adds/commits.

Can some one help out? Am I misunderstanding how this works, if so how can I apply the changes to the dev.mydomain filesystem for testing?

Any help would be much appreciated!!!

Dimitri Shukuroglou
  • 363
  • 1
  • 5
  • 13

1 Answers1

0

Now I have managed to do a remote push back to the dev.mydomain without errors, but when I check the files, I find these haven't been updated to include my adds/commits.

Pushing to an upstream remote repo means:

  • pushing to a bare repo (meaning there is no files to see! There is no working tree in a remote repo)
  • or pushing to a non-bare repo, but in that case you can only do so without error if you are pushing a branch which is not checked out in that remote repo.
    Which means none of the currently visible files on that upstream repo are modified.
    That is the all point of allowing that push: you are sure there is no discrepancies between that checked out branch HEAD and the HEAD you are pushing. The problem is detailed in "git push error: refusing to update checked out branch".

So I would recommend:

  • setting up a bare dev repo,
  • pushing to it,
  • and having a post-receive hook going to a second dev repo (this time non-bare) and pulling from the (updated) bare repo.
    See for instance this answer.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks alot for the clarification, I was getting mixed up on how to deploy with multiple environments! This has cleared it up for me now, thanks! – Dimitri Shukuroglou Jul 01 '13 at 07:05