Your destination for complete Tech news

Git

How to Push Code to GitHub Using Git (Beginner Guide)

939 0
< 1 min read

Intro:
Pushing local code to GitHub is an essential developer skill.

# Initialize Git
git init

# Add remote repository
git remote add origin https://github.com/username/repo.git

# Stage and commit
git add .
git commit -m "Initial commit"

# Push to GitHub
git push -u origin main

Takeaway:
Always set .gitignore before your first commit to avoid pushing unnecessary files.