Step 2
Step 2 — Your first Git commit
Step 2 — Your first Git commit
Git keeps your code safe and lets you rewind in time.
Install
# Windows
winget install Git.Git
# macOS
brew install git
First-time setup
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
Your first repo
mkdir my-first-repo
cd my-first-repo
git init
echo "# My first project" > README.md
git add README.md
git commit -m "first commit"
Connect to GitHub
After creating a new repo on GitHub:
git remote add origin https://github.com/your-account/my-first-repo.git
git push -u origin main