Publish Laravel Site from Github

Publish Laravel Site from Github

Make sure you meet all server requirements before continue

https://laravel.com/docs/7.x/installation#server-requirements

Laravel 8 requires PHP 7.3+.

Composer must have to be installed.

First Open your GitHub repository on your web browser and copy your git URL

eg: https://github.com/USERNAME/YOUR_REPOSITORY_NAME.git (this is the GIT URL)

Open your server SSH – Can use putty or some hosting have there own SSH terminal

git clone GIT_URL

Browse the folder where github project folder
cd foldername

Install all package files (package.json)
composer install

Generate the key
php artisan key:generate

Copy the default settings file
cp .env.example .env

Database Connection (I have used mysql)

sudo vi .env
/** change file content **/
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=demo
DB_USERNAME=root
DB_PASSWORD=admin@123
/** press “i”  for insert **/
Esc then :wq

Run your all migrations file
php artisan migrate

Redirect to Public Folder
Create .htaccess file and input this lines

Image Not showing issue fix
Add following code on .env file
FILESYSTEM_DRIVER = public

Whenever you made any changes on your GitHub project you can run the following command to update your code on the server
git pull
username – password

Previous Post
Setup PHP 7.3/mysql/mariadb/phpmyadmin on Ubuntu 20.04 [Digitalocean Droplet]
Next Post
Make Entire Laravel Site Password Protected [Works 8.x version]