GitHub Essentials
🔹 Introduction
Git and GitHub are essential tools for developers. Whether you're collaborating on open-source projects or just keeping track of personal projects, knowing how to use Git effectively is a must.
In this post, I'll share what I learned about setting up authentication (SSH keys vs PAT keys). I previously wrote an article about setting up SSH keys; here is the link , in this article, I will show how to use SSH keys and how to create and use PATs, along with some of the most commonly used Git commands—with examples of when and why to use them.
🔑 Authentication in GitHub
Before using Git with GitHub, you need a secure way to connect your computer to your GitHub account.
SSH Key: A cryptographic key pair (public + private) that allows secure, password-less authentication. Perfect for personal devices.
- A GitHub token you generate and use like a password. Useful when HTTPS authentication is required (e.g., in CI/CD pipelines or shared environments).
👉 When to use which?
- If you’re coding on your own laptop/PC → use SSH.
- If you’re on a server, CI/CD, or a shared environment → use PAT.
🔧 How I Created PAT key
1️⃣ Go to your GitHub account → Settings > Developer settings > Personal access tokens.
2️⃣ Click Tokens (classic) → Generate new token.
3️⃣ Choose scopes (e.g., repo for full repo access, workflow for GitHub Actions, etc.).
4️⃣ Copy the token and store it in a safe place. (it’s shown only once).