0

Good day,

On remote server I have:

  1. repository /git/project.git
  2. clone /individual/user/project/www (remote removed)
  3. clone /alpha/project/www (remote is set)
  4. clone /stable/project/www (remote is set)

On local machine:

  1. clone MAMP/htdocs/project (remote is set)

I use sftp connection to /individual/user/project to see changes in real-time and merging data from /individual/user/project to /alpha/project/ and after testing to /stable/project/

Question is:

  1. how can i by commit+push from local machine auto-update /alpha/project/ and then if everything is fine pull changes on /stable/project/
  2. how can i use special branches to auto-update specific remote folders, e.g.:
    1. by commit+push alpha branch auto-update /alpha/project/
    2. by commit+push stable branch auto-update /stable/project/
  3. how can i pull changes for /stable/project/ from my local machine

P.S. using Terminal, SourceTree, PhpStorm, gitolite
red Pro Git 1st Edition & Pro Git 2nd Edition

xoxn-- 1'w3k4n
  • 496
  • 1
  • 7
  • 18
  • Hi, have you get the answer what you want? If yes, please mark it. It will help others who have similar questions. – Marina Liu Dec 19 '16 at 05:05
  • Solution with _hooks/post-receive < git checkout -f_ not enough – xoxn-- 1'w3k4n Dec 20 '16 at 16:29
  • What's your detail steps and the error messages (if has)? You clone individual, alpha and stable repositories to your remote server. Is that means the real remote repositories for individual, alpha and stable are not located in your remote server? If it’s, you can clone to your local machine then everything changes simple. And you can't pull or push changes for these three repositories. – Marina Liu Dec 21 '16 at 07:53
  • Individual/project can be seen on www.ind.expl.tld, Alpha/project can be seen on www.alpa.expl.tld and when www.ind.expl.tld tested, then dev merges his data and commit+push master branch and after push www.alp.expl.tld have those changes without any on server-side pull! can it be done? – xoxn-- 1'w3k4n Dec 21 '16 at 12:02

1 Answers1

1

It’s really possible to pull from local repo/git server to a remote server. The most important thing is you need to create a bare repo on remote server by git init --bare.

More detail steps please refer git clone from local to remote

You can add remote to your local machine as below:

git remote add ind <URL for individual/project>
git remote add alpha <URL for alpha>
git remote add stable <URL for stable>

Then you can commit your local changes by git commit -am 'message'

Push local changes to individual,alpha and stable by git push ind && git push alpha && git push stable

If you want to pull changes to local, you can first check if it’s has remote-tracking branch by git branch -a. Such as if it list stable/master, so you can directly switch to it by git checkout stable/master.

If you want auto pushed to another repo, please refer here.

Community
  • 1
  • 1
Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • sorry for delay, but i more talking about hooks i guess. in link you provided is some information, but still that's not enough. i wish to push changes to branch alpha then automatically update clone on other server to see changes in real-time by entering www.test.project.tld if everything ok, i merge alpha with stable and after commit+push hooks update stable clone and then we can see chages on www.project.tld – xoxn-- 1'w3k4n Jan 04 '17 at 17:14
  • I guess i need some good tutor or documentation about hooks and example if there is availability to use ssh in hooks or php calls or else to automate "pull" on different machines – xoxn-- 1'w3k4n Jan 04 '17 at 17:16