Skip to content
Gallery
How to use Github
Share
Explore
by Ahmedur Rahman

How to Use GitHub via CMD on Windows
1. Install Git on Windows
Before using GitHub from CMD, you need to install Git.
Download the Windows version.
Run the installer and follow the setup steps. You can leave most options at default.
After installing Git, you can use Git commands in CMD or PowerShell.
2. Set Up Git (First Time Only)
Open CMD and run these commands, replacing your name and email:

git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
Check if Git is working:

git --version
3. Generate SSH Key (Optional but Recommended)
To securely connect to GitHub:

ssh-keygen -t ed25519 -C "your-email@example.com"
Hit Enter to accept the default file location.
Set a passphrase (or press Enter to skip).
Now add your SSH key to GitHub:
Get your key:
type %userprofile%\.ssh\id_ed25519.pub
Copy the output and go to GitHub:
Go to Settings > SSH and GPG Keys > New SSH Key
Paste your key, give it a name, and save.
4. Clone a Repository
To copy (clone) a GitHub repository to your PC:
git clone https://github.com/username/repository.git
or (if using SSH):
git clone git@github.com:username/repository.git
5. Navigate to Your Project Folder
Use cd to change directories:
cd repository
6. Make Changes and Save
Make changes to your files using any code editor (e.g., Notepad, VSCode).
7. Add Files to Staging
To track files for commit:
git add filename # Add a specific file
git add . # Add all changed files
8. Commit Changes
To save your changes with a message:
git commit -m "Your commit message here"
9. Push to GitHub
To upload your changes to GitHub:
git push origin main
Replace main with your branch name if different.
10. Pull Updates from GitHub
To download the latest changes from GitHub:
git pull origin main
Common Git Commands
Table 1
Column 1
Column 2
git status
See current changes
git log
View commit history
git branch
List branches
git checkout branch-name
Switch to a branch
git pull
Get latest updates
git push
Upload your changes
There are no rows in this table


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.