Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

skcin7's avatar

How does Forge know when I push changes to my master git repository?

I'm setting up Laravel Forge for the first time and loving it. FINALLY I have a SSL certificate on my website and it took about 2 minutes instead of the 2 days of headaches and frustrations it usually takes me. =D

My question is simple - how possibly can Forge know when I push changes from my local git repository to my repository hosted on Bitbucket? Since the changes are being pushed from my local machine to Bitbucket, I would think Laravel Forge has no way of knowing about it, but yet somehow it knows and pulls the changes into my live website automagically. How does Laravel Forge know how to do that?

Discuss!

0 likes
4 replies
christopher's avatar
Level 30

As soon as you add your Repo to forge, forge adds a connection to github/bitbucket with all the permissions that forge needs ( of course you have to confirm the access ). So forge can watch your repo. And if you change something, forge automatically trigger the ssh commands / deploy script:

cd /home/forge/yourdomain.com
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force
1 like
joseprr87's avatar

@christopher I supose that Forge uses bitbucket api to watch repo info. But it is is continuously doing requests to bitbucket to know repository changes?

In my bitbucket account, I see that Forge have not added webhooks or pipelines to be notified when a new push is done.

Please, sorry for my English :-(

ahuggins's avatar

did you set up a token or ssh key for bitbucket? I think you do, it's been a year since I set up my forge account. But when you connect it, he sets up a webhook. That webhook then gets hit anytime you push up your changes.

skcin7's avatar

OH! Right! Wow, I completely forgot that I set up API access for my Forge account to access Bitbucket. Okay, that explains it. Not sure why I didn't think of that earlier. Duh.

Thank you for answering the question.

Please or to participate in this conversation.