Tire of old school FTP to deploy your project. Here’s a shell script to spice up your day.
( this version works for SSH users who still use username password to upload via SFTP to their server )
Git Deployment made easy with this script. All you have to do is to create a shell script with this snippet and run it.
1. SSH to your server (instead of SFTP) and change directory to where this script was saved by the SysAd.
2. Run the shell script in this format : ./thisfile.sh project_name
3. Once you get the details of your project, exit ssh session and go to your working folder
4. In your working folder clone the repo project that you have just created
> git clone -o prod ssh://<user>@<server>/var/repo/project_name.git project_name && cd project_name
5. You should be in your clone working folder.
6. Assume you have all the files now in this folder to deploy.
7. Commit all your changes locally
> git add .
> git commit -m “initial commit”
7. When you’re ready to push everything to the server
> git push prod master
7. And Voila! you project is already live and deployed.
Here’s the shell script.