
A Beginner's Guide.
If you have anything to do pertaining to do with IT or code, you have sure as hell come across the term 'git'. This is my first ever blog post, the goal of which is to help pure beginners to setup & get started with Git.
📘 Difference between Git & GitHub
- Git and GitHub are both popular tools for software development, but they serve different purposes. Git is a version control system, while GitHub is a web-based hosting service for Git repositories.
- Git is a free and open-source software that allows you to track changes in your code over time. It's a distributed version control system, which means that you can work on your code offline and then sync your changes with a remote repository.
- GitHub is a web-based hosting service for Git repositories. It provides a number of features that make it easy to manage and collaborate on projects, including a GUI, web-based interface, notification system, code review system, and pull request system.
In short, Git is a tool for managing your code, while GitHub is a platform for hosting and collaborating on Git repositories.
| Git | GitHub | |
|---|---|---|
| Type | Version control system | Web-based hosting service |
| Cost | Free and open-source | Free for individuals, paid for businesses |
| Features | Track changes, collaborate, manage projects | GUI, web interface, notifications, code review, PRs |
| Ownership | Linux Foundation | Microsoft |
🗒️ Starting From Scratch
To get started with git, install it locally. For MacOS: brew install git. On Debian-based systems: sudo apt-get install git. Verify with git -v. Then configure:
| |
🥕 Configuring Git with GitHub
- Login to GitHub and create a new empty repository (no .gitignore or README).
- GitHub will require SSH keys for private repos.
SSH Setup
Generate a new SSH key pair:
| |
Start the ssh-agent and add your key:
| |
On MacOS, save to Apple Keychain and update ~/.ssh/config:
| |
Add to your global git config ($HOME/.gitconfig):
| |
Copy your public key (cat ~/.ssh/id_keyname.pub) and add it to GitHub Settings > SSH & GPG Keys > Add New SSH Key.
💍 Your First Commit
Initialize a new local repo and connect it to GitHub:
| |
Create a file and push your first commit:
| |
Every subsequent push uses the same add → commit → push sequence.
And That's All She Wrote!
We learned what Git is, how it differs from GitHub, how to initialize a repo, configure SSH keys, and make your first commit. Go build something!