DEV Community

Cover image for Beginner friendly article on Git bash and Git hub.
Steve Andrew
Steve Andrew

Posted on

Beginner friendly article on Git bash and Git hub.

Git is a version control system that intelligently track cahanges if file.
Git hub is a cloud based platform where one can store, share and work together with others to write a code.
Codes are stored in form of a repository.

How to install git bash in your computer
1.Download git from the official website and follow prompts for window users or microsoft store.
2.Run the installer and follow prompts

  1. Ensure components selected include "Git bash" and "Git GUI" are checked.
  2. Choose default editor - for our use we selected visual studio code.
  3. Select option of using Git from the command line and then follow prompts till installed.

1.To confirm if git is installed
git --version

2.To input name and user mail
git config --global user.name "STEVE"
git config --global user.mail "steveandrew97@gmil.com"

3.To confirm configuration
git config --global --list

4.How to generate SSH key that ensures Github connectivity is secure and will not prompt for password each time.

ssh--keygen -t ed25519 -C "steveandrew97@gmail.com"

Press enter to accept default file location

5.How to iniate the SSH Agent
eval "$(ssh-agent -s)"

6.Add SSH key
ssh-add ~/.ssh/id_ed25519

7.In putting the public key
cat ~/.ssh/id_ed25519.pub

How to push GitHub code
First, open your project in the terminal

1.Initialize Git

git init
2.Check file status

git status
3.Add File

git add.
4.Commit changes

git commit -m "My first commit"

5.Connect to GitHub Respository

git remote add origin https://github.com/username/repository-name.git

6.Push the code

git push -u origin main

The code will appear on GitHub

How to pull code from GitHub
pulling means getting the latest version of the project from gitHub

1.git pull origin main
this is usefull when working others or when switching devices

How to track changes using Git
2.To see changed files

git status
3.To see what exactly changed.

git diff
4.To view commit history

git log

Summary: Git enables the coding community network while making it possible for oe track,store and make changes in thier coding work.

Top comments (0)