X
X
xSkyFoXx2012-07-05 10:43:58
git
xSkyFoXx, 2012-07-05 10:43:58

How to deploy a project to the server using git pull?

I keep all my projects on github. After a bunch of commits, you usually want to upload the already installed version to the production server so that users can test the latest changes. Now I do it by hand.
How can this process be automated?
If it's just a server with git, then everything is clear. We initialize the repository on the server and push it there. But how to dodge in order to send the same changes to the production server in parallel to the github?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Vyacheslav Slinko, 2012-07-05
@KeepYourMind

I would recommend an external deployment system like github.com/capistrano/capistrano
Here is my config for a symfony2 project:

set :application, "appname"
set :deploy_to, "/var/www/#{application}"

set :repository, "[email protected]:vslinko/#{application}.git"
set :scm, :git

set :shared_files, ["app/config/parameters.yml"]
set :shared_children, ["app/logs", "web/uploads", "vendor"]
set :asset_children, []

set :user, "www-data"
set :use_composer, true
set :update_vendors, false

set :domain, "symfony.slinko.me"
role :app, domain

task :production do
  set :domain, "appname.com"
  role :app, domain
end

Then cap deployon the test server, and cap production deployon the working

G
Gleb Starkov, 2012-07-05
@colonel

Nothing needs to be pushed to the combat server. You are confusing processes.
Repository one. You have it on github. Push _only_ there.
Pull (git pull) both to the local for work, and to test and production.
That is, in combat, to deploy the project:

git clone ....

Further, if there are changes in the code
git pull

A
Alexander, 2012-07-05
@disc

Hooks will help you here. Read more here .

G
Gregory, 2012-07-05
@difiso

But how to dodge in order to send the same changes to the production server in parallel to the github?

You answered your own question: We initialize the repository on the server and push it there.
A git can have several repositories: they pushed to github, then a combat branch (master, most likely) to the server.

K
karenishe, 2012-07-05
@karenishe

Mercurial has a hook update=...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question