Getting Started with Git and GitHub: A Beginner’s Guide

1. What is Git?

Git is a version control system that helps you track changes in your code and collaborate with others.

2. What is GitHub?

GitHub is a cloud platform for hosting Git repositories, enabling collaboration, code sharing, and project management.

3. Install Git

  • macOS:
    brew install git
  • Windows:
    Download from git-scm.com.

4. Configure Git

git config –global user.name “Your Name”
git config –global user.email “your@email.com”

5. Create a Local Repository

git init my-project

cd my-project
6. Add and Commit Files
echo “# My Project” > README.md
git add README.md
git commit -m “Initial commit”

7. Create a GitHub Account

  • Sign up at github.com.
    8. Create a Remote Repository on GitHub
  • Click “New repository” on GitHub.
  • Name your repo and click “Create repository”.

9. Connect Local Repo to GitHub
git remote add origin https://github.com/yourusername/your-repo.git
git push -u origin master

10. Common Git Commands

  • git status – Check repo status
  • git add . – Stage all changes
  • git commit -m "message" – Commit changes
  • git pull – Get latest changes from GitHub
  • git push – Upload changes to GitHub

If you intrested to learn more concept please register free github begginers free course.

Leave a Reply

Discover more from Cialchemy

Subscribe now to keep reading and get access to the full archive.

Continue reading