What is Git, GitHub and why version control is important
1. What is Git & GitHub
Git is a distributed version control system (VCS)/tool that helps you save, track, and manage changes in your code. It keeps a history of your work so you can see what changed, when it changed, and who changed it.
Think of Git like a save system for your code, but much better than “Save As”.
GitHub is an online platform where you store Git projects.
GitHub allows you to:
- Back up your code
- Share code with others
- Work on the same project from different computers.
What is version control?
Version control is a system that tracks and manages changes to software code and files over time.
Why is version control important?
Version control helps:
- Track changes in your work
- Go back to an older version if something breaks
- Work safely without fear of losing files
- Collaborate with other people on the same project
2. Set Up the Git & GitHub Environments
Step 1: Create a GitHub Account
Sign up on GitHub using you credentials.
Step 2: Install Git
Download Git.
Install the application using the downloaded file.
Open Git Bash (Windows) or Terminal (Mac/Linux).
Configure your identity(Name and Email) to help Git Identify who is making the changes any time the changes are made.
NB: Use the email address used to sign up on GitHub.
git config -global user.name "your name"
git config -global user.email "youremail@example.com
Check to ensure your configuration has been set up.
git config -global --list
Step 3: Connect Git to Your GitHub Account
One of the easiest ways to connect your Git to your GitHub Account is using an SSH key which provides(digital identity) a secure password-less way to connect both to avoid the need for inputing a password every time.
To generate the SSH key on GitBash, run the command:
ssh-keygen -t ed25519 -C "youremail@example.com"
Now, you need to generate an agent; a helper program that holds your key in memory.
eval "$(ssh-agent -s)"
Add the key generated to the agent.
ssh-add ~/.ssh/id_ed25519
Lastly, print the public key and use it to connect your GitHub account.
cat ~/.ssh/id_ed25519.pub
Copy the key, navigate to the SSH and GHG keys on settings in you GitHub account and add a new SSH key.

Finally, authenticate your GitHub account in Git by running this command:
ssh -T git@github.com
3. Set up a Repository in GitHub and Project folder in Git
- Create a repository on GitHub
- Create a project folder in Git
mkdir Myproject
- Initialize Git in your project. Tells Git to start tracking this project.
git init
- Add files in your folder. Tells Git which files to track.
git add
- Save changes (commit)
git commit -m "your message"
4. Connect your project to GitHub)
git remote add origin https://github.com/yourusername/repositoryname.git
- Push code to GitHub (send code from your computer to GitHub) Pushing refers to uploading local commits to a remote server to make your code accessible to others.
git push -u origin main
- Pull code from GitHub (send code from GitHub to your computer).
git clone https://github.com/username/repositoryname.git
git pull origin main
clone creates/downloads a new copy on your local computer while pull updates your local files with any changes made.
- Check the status of your file.
git status
Checking status shows:
- Modified files
- New files
- Files ready to be committed
Summary Cheatsheet
Start Git - git init
Check status - git status
Stage files - git add
Save snapshot - git commit -m "message"
Download repo - git clone
Upload changes - git push
Update local - git pull
Top comments (0)