简体   繁体   中英

Copy project from local to server B (not a git server) after git push to server A (each via ssh)

I have a git project on my Mac. And i push my changes via ssh to a git-server ("Server B") (github or gitbucket or own should be irrelevant here).

And then there is the hosted webserver ("Server A") which shows the state of developement to the customers. From time to time i login to my webserver via ssh and type git pull to update the project before i tell the customer that there is a new version.

Is there a way to automate that? Is it possible to set something up, that always send the files to "Server A" with some kind of copy command after i do a git push on my local computer?

You can setup a git hook , post-commit , on your local computer to ssh and pull on the Server A each time you commit something.

There is no client side hook for pushing but if you don't want a hook to run each time you commit, you could simply alias a command like git push && bash update_SERVER_A.sh .

Apparently a pre-push hook is being added in 1.8.2 , so even better ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM