Github-bitbucket clone repository to local server Step by step with debugging 2020

Github-bitbucket clone repository to local server Step by step with debugging 2020



Hi there, today we are going to clone a repository and set it up on local xampp server. You might want to clone any laravel project or any other project you are welcome to this guide.





So i have a repository in my gihub account from where we need the link to repository. Go to your repository from where you want to clone and look for this link check this image.



Getting Repository Url

here you can see we have a link(url) to clone the repository.





Now open terminal and go to your htdocs folder where you want this repository to be cloned. You might need these commands.



Going to project folder using command line

cd .. //used for going back one directory
cd someFolder // someFolder is the directory where we enter using cd
sudo // it is required if permission error occurs
sudo chmod 777 someFolder //will allow read write full access to someFolder
ls // to see list of folders in directory
chmod -R 777 someFolder //will set all directory and sub directory full access of someFolder
clear // it is used for clearing the screen

If you need help you can check our video here





Full guide step by step

Once you are in the htdocs folder you need to run this command



Running cloning command

git clone //url of your repository

//In our case command looks like this 

git clone https://github.com/maninder987/Laravel-Blog-Website-Admin-Area.git

Hit enter/ Return key and this will clone the project to your local server.





it should look like this



Depending on the project size you might have to wait for few moments. Once done we need to install composer and nodejs if not installed already.





Installing Composer and Nodejs

Go to the project folder using terminal and run these commands to install composer.



php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === 'c5b9b6d368201a9db6f74e2611495f369991b72d9c8cbd3ffbc63edff210eb73d46ffbfce88669ad33695ef77dc76976') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

Once all commands are completed just type composer and hit enter/return key. you should see this screen.





If you get above given screen then all is good. but if not the run this command and check again.



curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Run all 4 commands again if required. Now you should have composer screen.





Next go to Nodejs website and install recommended version if not installed already. Once you have nodejs installed run below given commands One by one.



composer install
composer update
npm install 
npm update

So i hope you got all these commands. And all is good if facing problem you can add comment to this post.





Running Laravel commands

Now we need to run some Laravel artisan commands one by one.



//this command will generate the new key to your . env file 
php artisan key:generate

//this command will be used to clear the compiled classes and services
php artisan clear-compiled 

//this command will regenerate the list of all classes need to be included
composer dump-autoload

//this command will clear cache 
php artisan optimize:clear 

//this command will create the database table 
php artisan migrate

//this command will help you changing the permissions of directory
sudo chmod -R 777 //path to folder

//this will change the permission of file
sudo chmod 777 path to file

If you run “php artisan migrate” make sure you have a database created for example in phpmyadmin. And add database and username to .env file before running this command otherwise you will get an error.





That’s it your project should be up by now go to localhost/projectname/public to check.



If you want you can setup virtual host to easy access for your project follow below given tutorial to do that. Do like and subscribe us on youtube.





https://18.191.183.98/2019/04/09/how-to-setup-laravel-on-macos-xampp-2019/