DEV Community

Cover image for Week 2 -Git & GitHub
OKEKE CHIMA
OKEKE CHIMA

Posted on

Week 2 -Git & GitHub

Week 2–Git & GitHub Hands-On Assignment:
In this post, I’ll walk you through my Git & GitHub learning journey, where I set up Git locally, created and managed a project, explored branching workflows, and finally deployed my app on an AWS EC2 instance.

✅ *Task 1: Create a Local Project Directory
*

The first step was setting up a project directory. Since I’m on Linux, I installed Git using my package manager. Then I ran the following commands to initialize my project:
mkdir CodeTrack
cd CodeTrack
git init
This created a new folder named CodeTrack and turned it into a Git repository.

Task 2: Configure Git Locally
Next, I configured Git to identify me in this repository.
git config --local user.name "Okeke Christian"
git config --local user.email "eceokekechima@gmail.com"
git config --local --list
This ensures that all commits in this project are linked to my name and email.
When to use Local vs Global?
Global config: Applies to all repositories.

Local config: Overrides global settings for a specific repo (useful if you’re working on multiple projects with different identities).
Step 1: Git Setup Verification
I checked my Git version to confirm installation:
git --version

Output: 2.34.1

Step 2: Create & Modify Files
I created some starter files:
touch index.html style.css
Then I edited them using Visual Studio Code, copying initial content from a GitHub assignment repo.
Step 3: Track & Commit Files
I staged and committed my changes:
git add index.html style.css
git commit -m "Initial commit — Added index.html and style.css"
To verify my commits, I used:
git log --oneline
Step 4: Branching Workflow (Adding Contact Page)
One of the best parts of Git is branching. I created a feature branch to add a Contact Page.
git checkout -b feature/contact-page
touch contact.html
git add contact.html
git commit -m "feat(contact): add contact page with email and phone"
I also updated index.html to include a link to contact.html, then committed the changes.
After switching back to main, I confirmed the link wasn’t visible until I merged the branch.
git checkout main
git merge feature/contact-page
Lesson learned: Changes in a feature branch stay isolated until merged into main.
Step 5: Deploying on AWS EC2
I deployed my static site on an AWS EC2 instance with Nginx.

Steps included:
1.Launch EC2 (Ubuntu).
2.SSH into the instance:
3.ssh -i "cc-key.pem" ubuntu@
4.Install Nginx & start the service.
5.Copy project files (index.html, style.css, contact.html) into Nginx’s web directory.

6.Access the site via browser using the EC2 public IP.
GitHub Profile Setup
I updated my GitHub profile with a professional bio:
Network Engineer | Cloud & DevOps Enthusiast | Learning Git & GitHub
I also added my profile picture and location.
🔎** Why does this matter?**
A professional GitHub profile acts like a live portfolio — showcasing real projects, coding style, and collaboration skills. This builds credibility with recruiters and collaborators.
Forking & Pull Request Workflow
Finally, I practiced contributing to an open-source repo (mini_finance):
Forked the repo.
Cloned it locally & set up SSH authentication.
Created a new branch feature-readme-update.
Updated README.md with assignment notes.
Pushed changes and opened a Pull Request.

👉 Why a PR is important?
A Pull Request is not just about merging code — it’s about collaboration, code review, and knowledge sharing.

Key Takeaways
Local vs Global Git config helps manage identity across projects.
Branching keeps features isolated until merged.
GitHub is more than storage — it’s your portfolio.
Deployment on EC2 gives real-world DevOps exposure.
Pull Requests encourage teamwork and clean code practices

Top comments (0)