DEV Community

Cover image for Simple Guide to Setting Up Git and GitHub
Mohammad Shahzeb Alam
Mohammad Shahzeb Alam

Posted on • Originally published at mdshahzebalam.hashnode.dev

Simple Guide to Setting Up Git and GitHub

Introduction

Git is a Version Control System. It is a Tool that keep Track of your Code if you Changes Anything Git Will Recognise it Immediately and Change it Accordingly.

Github is a Online Hosting Service of your Git Repo. In Simple Word its a Cloud For Developers like you Store your Data in Cloud as Same Github Does for Us to Keep Track of Our Code and Collaborate With Others its Easy using Github.

Installation

If you are Using Windows

  • Go to Site git-scm.com

  • Download According to your OS

  • After Downloading Install Git

  • After Completing Installation Open Command Prompt In your System and Paste These Command

git --version
Enter fullscreen mode Exit fullscreen mode

If you See a Version, Then Git Is Installed Successfully ✅

If you are Using MacOS or Linux Then Follow These

  • Open Terminal In your System

  • Then Copy these Commands and Paste it in your Terminal and Run

sudo apt update
sudo apt install git
Enter fullscreen mode Exit fullscreen mode
  • After Installation Completed then Paste These Command
git --version
Enter fullscreen mode Exit fullscreen mode

If you See a Version, Then Git Is Installed Successfully ✅

Making A Github Account

  • Go to These Site github.com

  • Now Sign Up Using your Details

  • Now Setup Everthing In Github

Your Github Account is Ready to use Now

Setting Up Git

  • Open your Terminal again

  • Now Configure your Git With Github Account

git config --global user.name "Your Name"
git config --global user.email "your@email.com"
Enter fullscreen mode Exit fullscreen mode

Creating a First Repo

  • Open github.com

  • Now go to The Repositories Section

  • Click New Repo

  • Add Name of Repository

  • Click On Create Repository

  • Now It Will Show Like These

Now Open your Code Editor and Copy Paste These Commands

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/your_github_username/Project.git
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

Pro Tip Always Use add . It Will add All Files of your Project

Congrats 🎉 now your project is live on GitHub!

Common Commands of Git

  • git status - Check changes

  • git log - See commit history

  • git pull - Get latest updates

  • git push - Upload changes

Git & Github Is The Main Foundation of Open Source Collabaration

Thanks For Reading These Article ❤️ and Also Share Your Thoughts in The Comments ☺️

Top comments (0)