Reputation:
Is there any way, to run website, using source from Git?
For example, I have private repository in Bitbucket, and I want to use this source in my website automatically (so the source will be automatically downloaded on my server) and when I make changes in repository (for example, update any file), the source is automatically updated in my webisite.
In this case, I want to use Laravel.
Thank you.
Upvotes: 1
Views: 67
Reputation: 558
You can achieve this if you have git installed on the target machine by using a post-receive hook.
Repository init (instructions are for Linux)
Run git init --bare
#!/bin/sh git --work-tree=/var/www/your_site --git-dir=/var/repo/your_name.git checkout -f sudo /usr/local/bin/post-receive-your_site
#!/bin/sh find /var/www/your_site/ -type f -group 'git' -exec chown web:web {} \; find /var/www/your_site/ -type d -group 'git' -exec chown web:web {} \;
cd /usr/local/bin
ln -s /var/repo/your_name.git/hooks/post-receive-your_site
git remote add live <YOUR NEW REPOS>
, and then you can push to production by running git push live master
.Upvotes: 0
Reputation: 113
It sounds like what you're looking for are webhooks. Webhooks allow for a git command to be executed automatically when a specific task is done, such as a 'git push' to your repository.
In your instance a webhook could be set up to execute a script on your server to run a 'git pull' command. Here's the documentation that Bitbucket provides on the subject - https://confluence.atlassian.com/display/BITBUCKET/Manage+Webhooks
Upvotes: 0