6.2 Getting Started with GitHub
Creating a GitHub Account
- Visit github.com.
- Click Sign up in the top-right corner.
- Enter your username, email, and password.
- Verify your email address to activate your account.
Configuring Git Account Locally (First-Time Setup)
After installing git locally, set your name and email (these appear in your commits):
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
Verify your configuration:
git config --list
Creating a New Repository
-
Click the + icon → New repository.
-
Enter:
- Repository name (e.g.,
my-first-repo) - Description (optional)
- Choose Public or Private visibility
- Repository name (e.g.,
-
(Optional) Check “Initialize this repository with a README.”
-
Click Create repository.
Adding Files
Using GitHub Web
- Open your repository.
- Click Add file → Upload files.
- Drag and drop or choose files manually.
- Write a commit message (e.g., “Add initial files”).
- Click Commit changes.
Using the Command Line
git clone <repo-url>
cd <repo-name>
echo "Hello GitHub" > hello.txt
git add .
git commit -m "Add hello.txt"
git push origin main