A few days ago I was writing post related to git in which I described code management using git (its version control tool). You can browse on click below link.
code management in development process
Now we make more discussion on git. It makes a backup of your code even more also it make deployment of code. Nowadays many companies host a git on our hosting like Bitbucket, Gitlab both companies provides an unlimited repository with a private way so that you can manage more project repository. Now deployment (movement of source code from git repository to hosting) also a basic requirement because when a developer push a code then it also need to deploy on production or development environment so that on both places the code become same on hosting and your git repository.
Auto deployment has so many advantages some of them I describe below.
- On both places hosting as well as the repository has the same source code so there is no confusion.
- There is minimize the human error (like forgot to upload any code or images)
- There is no need to handle a separated FTP connection for upload
But when we move to deployment then many companies came to the front of you that provides services so their little confusion occur. But as a human nature, everyone chooses cheaper or free service. So I make a lot of research on that & find an easy way of deployment of git repository to hosting. First, i start research from the free repository providing companies like Bitbucket & Gitlab. Both of the companies provide the Pipeline services with the help of that you can carry out the deployment process. I personally use bitbucket pipeline as deployment. I will show you how to use with the help of the video which placed below.
I also write below steps with the help of that you can achieve same which as follows
- When you log into our git then you will find option “pipeline new” click on that.
- Then pipeline will tell you to configure our yml file. so there is need steps for configuration first init git at a repository. Yml file modifies for push request.
Below code for init
below code for push request deployment.
After that git provides the .gitignore file in made entry so that git not tracking yml file.
But GitHub still facing the problem but one thing great it provides the hook with the usage of that you can make the deployment. Below I paste the link.
Just need to make configuration & add file deploy.php in the web hook on the GitHub so whenever you push the code then the hook call & the file is deployed at the hosting.