4

I manage two live websites: One is behind a corporate firewall and the other is a duplicate (stripped down) version hosted on Bluehost. I believe I can use some proxy settings with git to push from behind the firewall so that the Bluehost version will receive those changes. I also have XAMPP and a Linux VM on my laptop so that I can do all the testing there and replicate the firewall settings on my development setup.

Where should I place the "origin" so as to dictate the sync between the two live servers? I don't think I want to use GitHub because I don't want my code to be on another server. Should I push my repositories to the server behind the firewall, the Bluehost server, or even possibly my local machine (although I don't think that's possible).

Thanks in advance.

Community
  • 1
  • 1
AlxVallejo
  • 3,066
  • 6
  • 50
  • 74
  • It doesn’t really matter. You can put a remote repository on all those machines and have neither of them named `origin`. I’d choose that machine as the “main” repository that is the most accessible for you and all other developers. – poke Aug 21 '12 at 14:36
  • If you name neither repository origin, then where do you push your commits? – AlxVallejo Aug 21 '12 at 15:27
  • The “origin” is just a convention, it is the default name of the repository you clone from. But in fact, you can name any remote repository whatever you like. There does not need to be an “origin”. You push usually by specifying the remote repository: `git push notorigin branch` or `git push notorigin`. If you set up upstream (or tracking) information to a branch (for example using `git push -u notorigin branch`) you can then just use `git push` and it will get the upstream repository from the configuration (which again does not need to be origin). – poke Aug 22 '12 at 00:01

1 Answers1

1

It would be preferable to put the origin in your repo behind the firewall, pointing to (referencing) the Bluehost one.
That way, you can pull from Bluehost back to your corporate repo (after you have pushed to Bluehost from any other remote repo).

The idea of pushing anything from behind a corporate firewall to "outside" is generally frowned upon by ITSec team.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Wouldn't I pull from origin, make my changes on local, then push to both origin and Bluehost from my local? I can setup a repo without having to pull from origin, right? – AlxVallejo Aug 21 '12 at 15:40
  • @AlxVallejo for the very first empty repo, yes you can setup a repo without pulling from origin. For the other repo, you would clone that initial repo (which would set origin pointing to that initial repo) – VonC Aug 21 '12 at 15:43
  • @AlxVallejo So I suggest cloning Bluehost in your corporate environment, in order to have an `origin` referencing Bluehost , but only for subsequent sync (ie for pulling from `origin`): you can push from local to Bluehost, but I wouldn't recommend pushing to corporate (this is generally forbidden in that way): corporate should pull regularly from Bluehost to complete the sync. – VonC Aug 21 '12 at 15:45