The era of manual file transfer is OVER! There are millions of ways to deploy and maintain your website now. Manual and uncontrolled transfers are inefficient and lead to mistakes. (read https://css-tricks.com/deployment/).
There are platforms that do the job for you now. Version-control, transfers, staging, tracking, etc. To name just a few: ftploy.com, deployhq.com, atlassian.com, pagodabox.io. There are also Terminal-based solutions such as Capistrano.
In any case, you need version-control. It is NECESSARY and whoever isn’t using version-control is heading to a disaster. GIT is the way to go. In this article I’ll explain how to continue using GIT and add another tool to deploy your website through FTP with one simple command: git-ftp push
Welcome to git-ftp
Here is how to set it up.
- Enter your project directory
- Initialise your git repo
- Add project files to git repo
git add –all
- Make your first commit
git commit -m “Initial commit”
- Install git-ftp on Mac OSX
- Place a shell script into your project folder named “gitftp.sh” and containing the following lines. Don’t forget to replace <> with your values. (If you’re concerned with security issues and storing passwords in clear, just add the -p option to your git-push in order to be prompted for your password):
git config git-ftp.url <URL/path_to_folder>
git config git-ftp.user <username>
git config git-ftp.password <password>
- Make script executable and execute it:
chmod +x gitftp.sh
- Create a “.gitignore” file.
Add these lines in it:
- Initialize git-ftp
If files are already on server: git ftp catchup
Or if you want all files to be uploaded to the server for the first time: git ftp init
- FTP push is the bomb! It will only upload to your FTP server the files that have been modified in your GIT repo.
Beautiful isn’t it?