Background
I need Git on the Cent-OS that I am working on.
I am on v8 of CentOS.
Outline
- Is Git Installed?
- Install Git
- Review Git Install
- Configure Git
Tasks
Is Git Installed?
which
syntax
which [appl]
sample
which git
output
Output Image
Output Text
>which git /usr/bin/which: no git in (/home/dadeniji/.local/bin:/home/dadeniji/bin:/home/dadeniji/.local/bin:/home/dadeniji/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/local/go/bin:/usr/local/go/bin) >
Explanation
We have confirmation that git is not installed.
Install Git
dnf
dnf install
syntax
sudo dnf install [package]
sample
sudo dnf install git
output
Confirmation Pre
Output Image
Output Text
>sudo dnf install git [sudo] password for dadeniji: Last metadata expiration check: 0:01:04 ago on Thu 26 Nov 2020 05:52:58 PM PST. Dependencies resolved. =============================================================================================================================================================== Package Architecture Version Repository Size =============================================================================================================================================================== Installing: git x86_64 2.18.4-2.el8_2 AppStream 186 k Installing dependencies: git-core x86_64 2.18.4-2.el8_2 AppStream 4.0 M git-core-doc noarch 2.18.4-2.el8_2 AppStream 2.3 M perl-Error noarch 1:0.17025-2.el8 AppStream 46 k perl-Git noarch 2.18.4-2.el8_2 AppStream 77 k perl-TermReadKey x86_64 2.37-7.el8 AppStream 40 k Transaction Summary =============================================================================================================================================================== Install 6 Packages Total download size: 6.6 M Installed size: 36 M Is this ok [y/N]:
Confirmation Post
Output Image
Output Text
Downloading Packages: (1/6): git-2.18.4-2.el8_2.x86_64.rpm 504 kB/s | 186 kB 00:00 (2/6): perl-Error-0.17025-2.el8.noarch.rpm 369 kB/s | 46 kB 00:00 (3/6): perl-Git-2.18.4-2.el8_2.noarch.rpm 611 kB/s | 77 kB 00:00 (4/6): perl-TermReadKey-2.37-7.el8.x86_64.rpm 304 kB/s | 40 kB 00:00 (5/6): git-core-doc-2.18.4-2.el8_2.noarch.rpm 1.3 MB/s | 2.3 MB 00:01 (6/6): git-core-2.18.4-2.el8_2.x86_64.rpm 1.5 MB/s | 4.0 MB 00:02 --------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 2.1 MB/s | 6.6 MB 00:03 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : git-core-2.18.4-2.el8_2.x86_64 1/6 Installing : git-core-doc-2.18.4-2.el8_2.noarch 2/6 Installing : perl-TermReadKey-2.37-7.el8.x86_64 3/6 Installing : perl-Error-1:0.17025-2.el8.noarch 4/6 Installing : perl-Git-2.18.4-2.el8_2.noarch 5/6 Installing : git-2.18.4-2.el8_2.x86_64 6/6 Running scriptlet: git-2.18.4-2.el8_2.x86_64 6/6 Verifying : git-2.18.4-2.el8_2.x86_64 1/6 Verifying : git-core-2.18.4-2.el8_2.x86_64 2/6 Verifying : git-core-doc-2.18.4-2.el8_2.noarch 3/6 Verifying : perl-Error-1:0.17025-2.el8.noarch 4/6 Verifying : perl-Git-2.18.4-2.el8_2.noarch 5/6 Verifying : perl-TermReadKey-2.37-7.el8.x86_64 6/6 Installed products updated. Installed: git-2.18.4-2.el8_2.x86_64 git-core-2.18.4-2.el8_2.x86_64 git-core-doc-2.18.4-2.el8_2.noarch perl-Error-1:0.17025-2.el8.noarch perl-Git-2.18.4-2.el8_2.noarch perl-TermReadKey-2.37-7.el8.x86_64
Explanation
- We appear to have successfully installed git version 2.18.4
Review Git Install
git
git version
syntax
git --version
sample
git --version
output
Output Image
Output Text
git --version git version 2.18.4
Explanation
Confirmed that git version 2.18.4 is installed.
Configure Git
git
git config
git config –list
syntax
git config --list
sample
git config --list
output
Output Image
Output Text
git config --list
Explanation
Empty Configuration List
git config –global
syntax
git config --global user.name [name] git config --global user.email [emailAddress]
sample
git config --global user.name Daniel git config --global user.email "Daniel@yahoo.com"
git config –list
syntax
git config --list
sample
git config --list
output
output – Text
git config --list user.name=Daniel user.email=Daniel@yahoo.com
References
- Digital Ocean
- Lisa Tagliaferri
- How To Install Git on CentOS 8
Link
- How To Install Git on CentOS 8
- Lisa Tagliaferri