Step 2 – Script Configuration
Next step is to configure the script itself, it’s very simple:
Open the file deploy.php and configure it as you wish:
private $source = 1; // 0 for Bitbucket, 1 for GitHub private $user = 'username'; // Site username private $pass = 'password'; // Site password private $repo = 'reponame'; // repository name private $deploy = '/home/account/public_html/'; // directory to deploy repository, we've included a tool to know what is the exact private $download_name = 'commit.zip'; // name of downloaded zip file, you can leave it like this private $debug = false; // false = hide output. If true, will generate a log with all the activities. private $process = 'deploy'; // deploy or update - Deploy will insert all the files in the commit, even if they weren't changed, update will only apply the changes. // files to ignore in directory private $ignore_files = array('README.md', '.gitignore', 'config.php', 'wp-config.php', 'deploy.php');
$source = insert 0 or 1 if you’re using Bitbucket or Github;
$user = your username to access the repository, it’s needed for private and public repositories;
$pass = password to access the accounts;
$repo = the name of the repository you created on the sites. You can check it on the link: https://github.com/username/repository/;
$deploy = the address the folder.php gave you. Always end with ‘/’;
$download_name = not very important, it’s just the name the script will give to the .zip when it receives the commit from the repository;
$debug = true or false, it will log every action to a file in the same folder as the deploy.php
$process = deploy or update are available here. Deploy will replace all the files even if they weren’t changed and update will replace only the files with changes. Please be advised that for very large repositories (+40Mb) it’s recomended to use update.
$ignore_files = an array with the name of the files you don’t want to update on the server, even if they are commited. This is particularly useful for config files, as they have different configurations on local and live servers. Just insert the files like in the example above.