Push Code to GitHub in 2 Easy Methods

How to Push Your Code to GitHub 🤗 #2 Methods Every Beginner Should Know! Whether you're a beginner or brushing up your workflow, here's a clean step-by-step guide to get your project on GitHub. ━━━━━━━━━━━━━━━━━━━━━━ 🔷 METHOD 1: Local First → Push to GitHub ━━━━━━━━━━━━━━━━━━━━━━ ✅ Step 1 — Install Required Tools Make sure you have: • Visual Studio Code • Git installed → verify with: git --version • A GitHub account ✅ Step 2 — Create a New Project Folder Option A (VS Code): File → Open Folder → Create new folder Option B (CMD): mkdir my-project cd my-project code . ✅ Step 3 — Initialize Git git init 👉 Creates a hidden .git folder — Git starts tracking your project! ✅ Step 4 — Create Your Project Files Add your files e.g. main.py, requirements.txt, etc. ✅ Step 5 — Stage Your Files git add . 👉 Tells Git to track all files ✅ Step 6 — Commit Your Code git commit -m "Initial commit" 👉 Saves a snapshot of your project ✅ Step 7 — Create a Repo on GitHub • Go to GitHub → Click New Repository • Name it (same as your folder — recommended) • Click Create Repository ✅ Step 8 — Link Local Project to GitHub git remote add origin https://lnkd.in/dmTgth4z ✅ Step 9 — Push to GitHub 🎉 git branch -M main git push -u origin main ━━━━━━━━━━━━━━━━━━━━━━ 🔷 METHOD 2: GitHub First → Clone Locally ━━━━━━━━━━━━━━━━━━━━━━ Prefer to start on GitHub? This is the cleaner approach for many developers! ✅ Step 1 — Create a Repository on GitHub • Go to GitHub → Click New Repository • Give it a name (e.g., my-project) • ✅ Check "Add a README file" (optional but recommended) • Choose Public or Private • Click Create Repository ✅ Step 2 — Copy the Repository URL • Click the green Code button • Copy the HTTPS URL: example:https://lnkd.in/dmTgth4z ✅ Step 3 — Clone the Repo Locally Open your terminal / CMD and run: git clone "past url" example: git clone https://lnkd.in/dmTgth4z 👉 This downloads the repo and creates a folder automatically! ✅ Step 4 — Open the Project in VS Code cd my-project code . ✅ Step 5 — Add Your Project Files Create your files e.g. main.py, requirements.txt, etc. ✅ Step 6 — Stage & Commit git add . git commit -m "Initial commit" ✅ Step 7 — Push Back to GitHub 🎉 git push origin main 👉 Since you cloned it, the remote is already linked — no need for git remote add! Credit: Krish Naik, Sunny Savita ━━━━━━━━━━━━━━━━━━━━━━ 💡 Which method should you use? 👉 Method 1 — when you already have a local project 👉 Method 2 — when you're starting fresh (cleaner & faster!) Save this post for your next project! 🔖 Found this helpful? ♻️ Repost to help fellow developers! #AIEngineering #PythonBeginner #Coding #TechMadeEasy #LearnToCode #PythonTips #Git #GitHub #VersionControl #Programming #Developer #VSCode #Python #OpenSource #CodingTips #SoftwareEngineering

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories