Skip to content

git-deploy-php is a simple php-based tool that deploys your Git repositories to FTP servers, and keeps them updated automatically.

Notifications You must be signed in to change notification settings

Ciki/git-deploy-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-deploy-php

Description

git-deploy-php allows quick and easy deployments of Git repositories to FTP servers.

It was created to simplify the process of deploying projects to shared hosting environments where shell access is not available, and to save bandwidth, by only uploading the files that have changed.

Usage

Using git-deploy-php could not be easier.

  1. Drop git-deploy into your project.
  2. Create the deploy.ini file (see below).
  3. Execute php git-deploy.

And there you go. It's that simple.

deploy.ini

In the root directory of your source code, create a deploy.ini file.

Note: deploy.ini is the default file's name. You can name it staging.ini, for example, and execute php git-deploy staging. That serves as an easy way to separate the deployment to staging and production servers.

; This is a sample deploy.ini file.

[example]

skip = false
user = example
pass = password
host = example.com
port = 21
path = /path/to/installation
passive = true

; If that seemed too long for you, you can specify servers like this:
[ftp://example:password@example.com:21/path/to/installation]

The first time it's executed, git-deploy will assume that your deployment server is empty, and will upload all the files in the git repository. If you've already deployed your project's files previously, you have to create a REVISION file on your deployment server, containing the hash of the revision it's currently in.

To get the hash of the current revision, you can use:

git rev-parse HEAD

Advanced Usage

Revert a deployment

If you deployed using git-deploy and you want to go back to the previous deployment, all you need is --revert:

php git-deploy [your_ini_file_name] --revert

If you use deploy.ini (i.e., if you didn't give the .ini file a custom name), then you can simply use:

php git-deploy --revert

Deploy a specific commit

php git-deploy [your_ini_file_name] -r [your_commit_hash]

If you use deploy.ini (i.e., if you didn't give the .ini file a custom name), then you can simply use:

php git-deploy -r [your_commit_hash]

Note: If you want to, instead of using a commit hash, you can use a tag, or any other identifier that git-diff can understand.

List files to upload and delete

Sometimes, you may just want to see what files are to be uploaded to the FTP server, and which ones are to be deleted. In this case, you can use -l (lowercase L):

php git-deploy [your_ini_file_name] -l

If you use deploy.ini (i.e., if you didn't give the .ini file a custom name), then you can simply use:

php git-deploy -l

Pretty simple, huh?

How It Works

git-deploy stores file called REVISION on your server inside the root path to your application. This file stores the current revision of your application residing on your server.

When you run a git deploy, git-deploy downloads the REVISION file, and checks to see what files are different between revisions and either upload the changed files or deletes them from the server.

Suggestions, questions and complaints.

If you've got any suggestions, questions, or anything you don't like about git-deploy-php, create an issue. I'd really appreciate your feedback. Feel free to fork this project, if you want to contribute to it.

About

git-deploy-php is a simple php-based tool that deploys your Git repositories to FTP servers, and keeps them updated automatically.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%