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://email@example.com/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 to the server
$ ssh firstname.lastname@example.org
Assumed the project want to store in /var/www/mywebapp.com
git remote add jslim89 https://email@example.com/myorganization/my-private-app.git
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
Update the project
$ git pull jslim89 master
# Then type your bitbucket account password, because we are not using private key
jslim89 here refer to the URL https://email@example.com/myorganization/my-private-app.git, master refer to remote master branch
For other developers
They also do the same step with you
git remote add dev1 https://firstname.lastname@example.org/myorganization/my-private-app.git
git pull dev1 master
type in their own password