Lazy way for web application staging deployment
When comes to deployment, usually what we do is copy modified files over the server. It may takes some time on doing so.
I’ve discover an easy way to do deployment.
Example: I have a PHP web app hosted on Bitbucket, let say https://firstname.lastname@example.org/myorganization/my-private-app.git and this project has 3 developers involved. Now I want to deploy on staging server for client to test.
$ ssh email@example.com
$ mkdir /var/www/mywebapp.com
The Git URL please don’t use SSH, use HTTPS instead. The reason here is we don’t want to put our private key on server. Besides, there are 3 developers share the same copy.
The last command here you can see I put my username, you can put whatever you want as long as you can remember. Usually what we see is
git remote add origin ...., but in this case different developers may have different URL, e.g. https://firstname.lastname@example.org/myorganization/my-private-app.git. Thus use username rather than origin
$ git pull jslim89 master
jslim89 here refer to the URL https://email@example.com/myorganization/my-private-app.git, master refer to remote master branch
They also do the same step with you
git remote add dev1 https://firstname.lastname@example.org/myorganization/my-private-app.git