How to use GIT Push and Pull command on Linux Debian 11.3
- 00:40 lsb_release -a
- 02:15 cd /home/linuxhelp
- 02:25 mkdir project
- 02:35 cd project
- 02:46 apt-get install git
- 03:10 git init
- 03:50 git status
-
04:15
git clone
- 04:32 nano /etc/hosts
-
05:05
git clone
- 05:19 ls
- 05:25 cd test_project
- 05:32 ls -la
- 05:51 touch test
- 05:58 ls
- 06:03 git add .
- 06:14 git commit -m "server"
- 07:21 git push origin master
TO USE GIT PUSH AND PULL COMMAND LINUX DEBIAN 11.3.
Introduction:
A Git pull command is one of many that claim responsibility for synchronizing remote content. The Git remote command specifies which remote endpoints will be used for syncing. A remote repository can be updated by using the Git push command. The Git fetch command is often confused with the Git pull command.
Procedure:
Step 1: check the version of the OS by using the below command
root@linuxhelp: ~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Step 2: Go to browser and login to GitLab as shown in the below image
Step 3: Create New Gitlab Project by using the below command
Step 4: Go to command terminal, create new folder and name the folder, I created as “project” in home location by using the below command
root@linuxhelp: ~# cd /home/linuxhelp/
root@linuxhelp:/home/linuxhelp#mkdir project
Step 5: Next, Move the Project folder by using the below command.
root@linuxhelp:/home/linuxhelp# cd project/
Step 6: Download the Git by using the below Command.
root@linuxhelp:/home/linuxhelp/project# apt-get install git
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libgnutls-dane0 libunbound8
Use 'apt auto remove' to remove them.
The following additional packages will be installed:
git-man liberror-perl
Suggested packages:
git-daemon-run | git-daemon-sylvinite git-doc git-ell git-email git-guy
gitk gitweb git-CVS git-mediatic git-svn
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 84 not upgraded.
Need to get 7,386 kB of archives.
After this operation, 37.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bullseye/main amd64 liberror-perl all 0.17029-1 [31.0 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 git-man all 1:2.30.2-1 [1,827 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 git amd64 1:2.30.2-1 [5,527 kB]
Fetched 7,386 kB in 1s (14.3 MB/s)
Selecting previously unselected package liberror-perl.
(Reading database ... 354972 files and directories currently installed.)
Preparing to unpack .../liberror-perl_0.17029-1_all.deb ...
Unpacking liberror-perl (0.17029-1) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.30.2-1_all.deb ...
Unpacking git-man (1:2.30.2-1) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.30.2-1_amd64.deb ...
Unpacking git (1:2.30.2-1) ...
Setting up liberror-perl (0.17029-1) ...
Setting up git-man (1:2.30.2-1) ...
Setting up git (1:2.30.2-1) ...
Processing triggers for man-db. (2.9.4-2) ...
Step 7: Next Run Git Init by using the below command.
root@linuxhelp:/home/linuxhelp/project# git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init. default Branch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /home/linuxhelp/project/. git/
Step 8: Go to GUI terminal, open Document in Project folder, click view and click show hidden file and show .git files as shown in the below image
Step 9: Check the Git status by using the below command.
root@linuxhelp:/home/linuxhelp/project# git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
Step 10: Next go to GitLab browser project and click clone and copy the http link go to command prompt and paste the command line
root@linuxhelp:/home/linuxhelp/project# git clone
http://gitlab.example.com/root/test_project.git
Cloning into 'test project'...
fatal: unable to access 'http://gitlab.example.com/root/test_project.git/': Could not resolve host: gitlab.example.com
Step 11: Next, enter the Host Entry by using the below command
root@linuxhelp:/home/linuxhelp/project# nano /etc/hosts
Step 12: Again, Run the Git clone command by using the below command
root@linuxhelp:/home/linuxhelp/project# git clone
http://gitlab.example.com/root/test_project.git
Cloning into 'test project'...
fatal: unable to access 'http://gitlab.example.com/root/test_project.git/': Could not resolve host: gitlab.example.com
Step 13: Long list the directory by using the below command.
root@linuxhelp:/home/linuxhelp/project# ls
test project
Step 14: Change the Test Project Directory by using the below command
root@linuxhelp:/home/linuxhelp/project# cd test project/
Step 15: Again, long list Directory by using the below command
root@linuxhelp:/home/linuxhelp/project/test_project# ls -la
total 16
drwxr-xr-x 3 root root 4096 Jul 19 05:55.
drwxr-xr-x 4 root root 4096 Jul 19 05:55 ..
drwxr-xr-x 8 root root 4096 Jul 19 05:55 .git
-rw-r--r-- 1 root root 16 Jul 19 05:55 README.md
Step 16: Create New File by using the below command
root@linuxhelp:/home/linuxhelp/project/test_project# touch test
Step 17: Long list the directory by using the below command
root@linuxhelp:/home/linuxhelp/project/test_project# ls
README.md test
Step 18: Next, Add the git add and git commit command by using the below command.
root@linuxhelp:/home/linuxhelp/project/test_project# git add.
root@linuxhelp:/home/linuxhelp/project/test_project# git commit -m "server"
[master a7bc065] server
Committer: root <root@debian-BULLSEYE-live-builder-AMD64>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 0 insertions (+), 0 deletions (-)
create mode 100644 test
Step 19: Finally use git push by using the below command
root@linuxhelp:/home/linuxhelp/project/test_project# git push orgin master
go to GitLab open the project test file push completed.
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps to Use Git Push and Pull Command Linux Debian 11.3. Your feedback is much welcome.
Comments ( 0 )
No comments available