DEV Community

Sasireka
Sasireka

Posted on

Git Push and Git Pull

GIT PUSH:
Step 1: In file manager, we have to create a folder(ex:HTML) inside a folder create a html file(ex:index.html)
Step 2: In gitlab, we have to create a group.
Step 3: Click group on the left side -> New group -> Create -> Groupname(ex: Group1) -> Public or Private -> Company or me -> Create group.
Step 4: After created a group, then we have to create a project.
Step 5: Create Project -> Projectname(ex: Project1) -> Public or Private -> Unclick README -> Create project.
Step 6: After created a project, we have to initialize the git repository in a html file (that was created in a step1).
Step 7: Open a folder(ex:HTML) inside that folder right click on the white space -> open in terminal
Step 8: In terminal we have to initialize the git,Open gitlab the commands will shown after we create a project, then change SSH to HTTPS in add files(five commands are there),first copy and paste the first two commands of Push an existing folder(ex: git init --initial-branch=main --object-format=sha1
git remote add origin git@gitlab.com:porfolio1582947/porfolio1.git)
Step 9: First two commands are used to initialize the git repository used only on the first time, then the next three commands are used frequently to push the code into gitlab.
Step 10: git status - to view the status of our folder(any modification, updates, delete like that)
Step 11: git add .(for multiple files)
Step 12: git commit -m"add file"
Step 13: git push
Step 14: In gitlab, refresh the page, our code files are shown under the project, in right side click gitlab pages, it will show the output for the code on browser.
(Note: Gitlab first show the output of index.html file)

GIT PULL:
Step 1: In file manager, create a new folder(ex.gitpull).
Step 2: In github, copy the code of the project.
Step 3: Open a folder(ex:gitpull) right click on the white space, click terminal.
Step 4: In terminal paste the code that we copied on step 2 [ex: git clone"......."]
Step 5: Second command - git pull

Top comments (0)