Setup Menus in Admin Panel

  • No products in the cart.

  • LOGIN

Pushing and Pulling Project in Gitlab

The push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repository. It’s the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.

Pushing your project in gitlab:

1. Create a project name. Here, I have created project name as news_portal.

 

Fig:Creating project name in gitlab

 

 

2. By default it will provide the following command line instructions:

Command line instructions:

Git global setup
git config --global user.name "Ganesh Khadka"
git config --global user.email "[email protected]"
Create a new repository
git clone https://gitlab.com/ganeshkhadka/news_portal.git
cd news_portal
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin https://gitlab.com/ganeshkhadka/news_portal.git
git add .
git commit -m "Initial commit"
git push -u origin master
Existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.com/ganeshkhadka/news_portal.git
git push -u origin --all
git push -u origin --tags

 

So, go to the command and set the username and email by typing the command:

 

git config --global user.name "Ganesh Khadka"
git config --global user.email "[email protected]"

 

 

Fig:Setting user name and email

After the successful set up of username and email following the following commands:

 

1.Go to the existing folder i.e /c/xampp/htdocs/Laravel_Project/news_portal
2.git init
3.git remote add origin https://gitlab.com/ganeshkhadka/news_portal.git
4.git add .
5.git commit -m "Initial commit"
6.git push -u origin master

 

Screenshot 1:

 

 

Screenshot 2:

 

Then after performing the above command, you have successfully push your project in the gitlab as in the screenshot below:

 

Fig:Screenshot after pushing a project in gitlab

 

Now, follow the below command:

git remote -v

 

After entering the above command you will see the following:

origin  https://gitlab.com/ganeshkhadka/news_portal.git (fetch)
origin  https://gitlab.com/ganeshkhadka/news_portal.git (push)

 

Screenshot:

 

 

Note:

If you made some changes in the code then you have to perform the following steps:

1.git add .
2.git commit -m "Changes you made in your code"
3.git push origin master
4.git status

 

 

How to clone(or download) project from GitHub or gitlab?

 

Step 1:

Create a folder name. I have provided folder name newsportal_clone

 

Step 2:

Open terminal and go to directory /c/xampp/htdocs/Laravel_Project/newsportal_clone

Type the following command:

git clone https://gitlab.com/ganeshkhadka/news_portal.git

 

Note:

https://gitlab.com/ganeshkhadka/news_portal.git is the path which you are going to clone from gitlab.

 

Screenshot 1:

 

Screenshot 2:

In this clone project, you have missed some of the folder such as vender,env etc. So, open the project and perform the following steps:

1. Open composer.json file and copy the following code:

php -r "file_exists('.env') || copy('.env.example', '.env');" 

Screenshot:




2.Open terminal and type the following command:

cd news_portal 
php -r "file_exists('.env') || copy('.env.example', '.env');"

->This command will create the .env file in your project folder.

Screenshot:

3.Then finally update the composer by using the following command:

composer update

It will take a few minutes to update the composer.

Screenshot  1:

 

 

Screenshot 2:

 

Fig:Screenshot of newly created .env,vendor file

 

Notes:

dd() :
->It is a laravel function which stops the execution and it will give response to what we have inserted inside dd() function.

Example:

<?php
Route::get('/', function () {
    return view('welcome');
});
Route::get('test', function () {
    dd('Hello welcome to laravel!!');
});

If we run the code:

newsportal.test/test

Then it will show the results:

 Hello welcome to laravel!!

 

Screenshot 1:

 

Screenshot 2:

Attachments14

SEE ALL Add a note
YOU
Add your Comment
 

Advanced Course Search Widget

Popular Courses

Course Categories

© PHPhelp. 2002 - 2018 All rights reserved.
X