Introduction to
Git & Github
Distributed version control
system to track changes in
source code.
Key Features: Benefits:
Tracks changes to files over time.
Facilitates efficient teamwork.
Enables collaboration across
teams.
Prevents code conflicts.
Maintains history and ensures Helps maintain code history.
reversibility of changes.
Example: Current mobile operating systems (e.g., Android and
iOS) rely on version control systems like GIT for tracking
updates, bug fixes, and feature releases.
GitHub
Cloud-based platform for hosting GIT repositories
Features:
Centralized code collaboration.
Public and private repository hosting.
Tools for issue tracking, pull requests, and project management.
Benefits:
Simplifies code sharing.
Enhances project visibility.
Supports open-source contributions.
Theroy Ends Here ......
How GIT and GitHub Work Together
Download Git First
https://git-scm.com/downloads
Download the git based on your software requirement
Download VS Code
https://code.visualstudio.com/download
Create your Account in GIThub
https://github.com/
Our Aim is to Create a Website and Host in github for public access
Head over to GitHub and create a new public repository named
username.github.io, where username is your username (or
organization name) on GitHub.
Configure Git
Open Git Bash:
Right-click and open Git Bash.
Set Username and Email:
Configure your Git identity:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
Verify Configuration:
git config --list
Generate an SSH Key
ssh-keygen -t ed25519 -C "your-email@example.com"
If your system doesn't support ed25519, use
Press Enter to save the key in the default location (~/.ssh/id_ed25519 or ~/.ssh/id_rsa).
Set a passphrase (optional, but recommended).
Add the SSH Key to the SSH Agent
eval "$(ssh-agent -s)"
Add Your SSH Key:
ssh-add ~/.ssh/id_ed25519
Copy the Public Key
cat ~/.ssh/id_ed25519.pub
Add the Key to GitHub:
1. Log in to GitHub.
2. Go to Settings > SSH and GPG Keys > New SSH Key.
3. Paste the key into the "Key" field, add a title, and click Add SSH Key.
Test the SSH Connection
ssh -T git@github.com
Clone the repository
git clone https://github.com/username/username.github.io
Open VS code
Create file name index.html and add some random text
Save the file
Open Terminal from VS code
git add --all
git commit -m “intial commit”
git push orgin master
…and you're done!
Fire up a browser and go to https://username.github.io.
Thanks