Git have some basic command we are simultaneously use Git log, Push, Pull and commit etc.
Git Is a free and open source platform and use Distributed version control, Basically tracking changes in any set of files. usually it used for coordinating work among programmers collaboratively developing source code during software development. Git are support Windows, Linux, MacOs and many type of operating systems.
Steps : Install Git In CentOs, AWS-Linux
- Install Git
- Set up Git
- Create working file
- Check git log
- Create GitHub Account
- Generate and copy 2FA password
- Push and Pull working data to Github account for use world wide.
Step: 1 Install Git
Use ” Yum update ” command for update all of require file of you systems.
# yum update -y
Step: 2 Set up Git
Use ” yum install git ” command for install git of that systems.
# yum install git -y
Step: 3
Use ” which ” command for knowing if git installed. or you can also use “ rpm -q git ” command for knowing.
# which git
Step: 4
Use ” Git –version ” command for knowing current version of git.
# git –version
Step: 5
Use this both command for set global identity which are visible on Girhub repository.
# git config –global user.name “Jhon”
# git config –global user.email “Example@gmai.com”
Step: 6
Use ” git config ” command for check above set identity.
# git config –list
Step: 7 Create working file
Use ” mkdir ” command for create a directory for git initialize
# mkdir India_git_directory
# cd India_git_directory
Step: 8
User ” git init ” command for initialize above create directory
# git init
Step: 9
Use ” cat, touch, vi, nano ” command for create a working file and save Ctrl+d
# cat >test_index.file
Write: Hi all welcome to Utechnoworld
Ctrl+d
Step: 10
Use ” git status ” command for check created file status.
# git status
—- Result—
On branch master
No commits yet
Untracked files:
(use “git add …” to include in what will be committed)
test_index.file
nothing added to commit but untracked files present (use “git add” to track)
Step: 11
Use ” git add . ” command add working file to staging area for commit.
# git add .
Step: 12
Use ” git commit ” command after completed of you work and check the last status before knowing git log.
# git commit -m “my first commit from india”
# git status
Step: 13 Check git log
Use ” git log ” command for check that created file log.
# git log
— Result —
commit e30497591de4e428cf8b757b68cc2c42f55c5395 (HEAD -> master)
Author: Jhon <example@gmai.com>
Date: Fri Sep 30 18:31:45 2022 +0000
my first commit from india
after check git log if you want to know the exact content of you file use ” git show ” command.
# git show e30497591de4e428cf8b757b68cc2c42f55c5395
Step: 14 Create GitHub Account
Create GitHub or GitLab account for backup and use globally of you work. then create a repository for store you content.
Copy that URL for pushing and pull of you working date.
step: 15
Use ” git remote add ” command to access of you Github repository.
# git remote add origin https://github.com/Utechnoworld/centralgit.git
Step: 16 Generate and copy 2FA password
Finally, you can push you working file to you Github account.
# git push -u origin master
User name: Utechnoworld
Password: Use Authenticate on GitHub with 2FA
Or
# git push -u “https://github.com/Utechnoworld/centralgit.git” master
How to Authenticate on GitHub with 2FA
- Go to Github account.
- Setting
- Developer Setting
- Personal access tokens
- Generate new taken
- Copy and user that taken for password
Step: 17 Push and Pull working data to Github account for use world wide.
Use ” git pull ” command to import from Github repository store date after pushing of you working date.
# git pull -u origin master
User name: Utechnoworld
Password: Use Authenticate on GitHub with 2FA
Step: 18 Ignore specific file
Final stapes, if you want ignore any file before commit like Java and css file. create a ” .ignore” file and mention all of file extension after ” * “.
# vi .gitignore
*.css
*.java
# touch indes.html text.css test.java
You can see ” .css and .java ” file ignore to commit.
# git status
Hmm is anyone else having problems with the images on this blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog. Any responses would be greatly appreciated.
I carry on listening to the newscast talk about getting free online grant applications so I have been looking around for the top site to get one. Could you advise me please, where could i get some?