Introduction
In the world of software development, version control is essential. Git is a version control tool that helps you track changes in your code, while GitHub allows for collaboration and showcases your projects. In this article, we will explore how to set up Git Bash, connect it to your GitHub account, and understand the basics of pushing and pulling code.
What is Git Bash?
Git Bash is a command line interface for Windows that provides a Unix-like environment for Git. It allows you to execute Git commands and manage your repositories efficiently.
What is Git Hub
GitHub is a web-based platform that uses Git for version control. It enables collaboration among developers, allowing them to see each other's work, contribute to projects, and maintain a portfolio of their projects.
Why Use Git and GitHub?
- Version Control: Track changes to your code over time.
- Collaboration: Work with others seamlessly.
- Portfolio: Showcase your projects to potential employers.
Installing GitBash
Download Git Bash: Visit Git Install select your operating system, and download the installer.
Install Git Bash: Follow the installation prompts to set up Git Bash on your device.
Verifying Installation
After installation, open Git Bash and run the following command to check the installed version:
git --version
*Configuring Name and Email on Git *
- Set your name
git config --global user.name "YourName"
-
Set your email
git config --global user.email "YourEmail"
Check configurations
git config --list
Connecting GitHub to Git Bash Using SSH Keys
An SSH key is a secure access credential used in the SSH protocol. It consists of a pair of cryptographic keys: a public key (stored on the server) and a private key (kept on your computer).
Steps to Generate an SSH
- Check for Existing SSH Keys:
ls ~/.ssh
- Generate a New SSH Key:
ssh-keygen -t ed25519 -C "YourEmail"
- Start the SSH Agent:
eval "$(ssh-agent -s)"
- Add Your SSH Key to the SSH Agent:
ssh-add ~/.ssh/id_ed25519
Adding Your SSH Key to GitHub
Copy the Public Key:
clip < ~/.ssh/id_ed25519.pub
Add the SSH Key to GitHub
- Go to GitHub, navigate to Settings > SSH and GPG keys > New SSH key. Paste the copied public key and give it a title (e.g., "GitHub Key"). Click Add SSH key.
Test Your Connection:
ssh -T git@github.com
Basic Commands in Git
mkdir "kenya"
Meaning: Make Directory
Function: Creates a new folder named "kenya". This command is used to organize your projects by creating a dedicated directory for related files.
cd "kenya"
Meaning: Change Directory
Function: Navigates into the "kenya" folder you just created. This allows you to perform actions within that specific directory.
git init
Meaning: Initialize Repository
Function: Initializes a new Git repository within the current folder ("kenya"). This command sets up the necessary files and structure for Git to track changes in this directory.
touch "nairobi"
Meaning: Create File
Function: Creates a new file named "nairobi" within the current folder. The touch command is commonly used to create empty files.
touch student.py
Meaning: Create Python File
Function: Creates a new Python file named "student.py". This file is ready for you to start writing Python code.
git add .
Meaning: Add Files to the Repository
Function: Stages all changes, including the newly created "nairobi" file, for the next commit. The . signifies that all files in the current directory should be added.t add .`
touch README.md
Meaning: Create README File
Function: Creates a README file named "README.md". This file typically contains information about the project, such as its purpose, how to use it, and other relevant details.
cd ~
Meaning: Change to Home Directory
Function: Navigates back to your home directory. The tilde (~) represents the path to the home directory of the current user, allowing you to quickly return to a familiar starting point.
In conclusion, mastering Git and Git Bash is essential for effective version control and collaboration in software development. By understanding these basic commands, you can efficiently manage your projects and contribute to others' work on platforms like GitHub.

Top comments (0)