Skip to content

Instantly share code, notes, and snippets.

@mkhlz
Created March 5, 2026 13:55
Show Gist options
  • Select an option

  • Save mkhlz/d64ae6d941009f51f1aaa8cd50f2ee35 to your computer and use it in GitHub Desktop.

Select an option

Save mkhlz/d64ae6d941009f51f1aaa8cd50f2ee35 to your computer and use it in GitHub Desktop.

Assignment: Your First Git & GitHub Project

Objective: By the end of this assignment, you will have installed Git on your Windows 10 computer, created a local repository, made your first "commit," and published your work to your GitHub profile.

Prerequisites:

  • A Windows 10 computer
  • A GitHub account (Already completed!)

Phase 1: Install and Configure Git

Since you are on Windows, we are going to install Git Bash, which gives you a great terminal environment to type your Git commands.

Step 1: Go to the official Git website: https://git-scm.com/download/win Step 2: Click on "64-bit Git for Windows Setup" to download the installer. Step 3: Open the downloaded file and click "Next" through the installation. You can leave all the default settings exactly as they are. Step 4: Once installed, click on your Windows Start menu, search for "Git Bash", and open it. A black command-line window will appear. Step 5: Tell Git who you are. Type the following commands into Git Bash, hitting Enter after each one. (Replace the placeholders with your actual name and the email you used for GitHub):

git config --global user.name "Your First and Last Name"
git config --global user.email "your.email@example.com"

Phase 2: Create a Local Repository

Now, let's create a folder on your computer and turn it into a Git repository.

Step 1: In Git Bash, navigate to your Desktop by typing:

cd ~/Desktop

Step 2: Create a new folder for your project called git-assignment:

mkdir git-assignment

Step 3: Move inside that new folder:

cd git-assignment

Step 4: Initialize Git! This command tells Git to start tracking this folder:

git init

You should see a message saying "Initialized empty Git repository..."


Phase 3: Create a File and Make Your First Commit

A repository isn't very useful if it's empty. Let's add a file.

Step 1: Create a new file called README.md and put some text inside it. Type this exactly:

echo "# Hello GitHub! This is my first repository." > README.md

Step 2: Check the status of your project. This is the most useful command in Git!

git status

You will see README.md listed in red, meaning Git sees it but isn't tracking it yet.

Step 3: Tell Git to stage the file (prepare it to be saved):

git add README.md

Step 4: Save the changes permanently by making a "commit". We must always include a message explaining what we did:

git commit -m "Initial commit: Added README file"

Phase 4: Create a Repository on GitHub

Now we need a place on the internet to send your local code.

Step 1: Open your web browser, go to GitHub.com, and log in. Step 2: In the top right corner, click the + icon and select "New repository". Step 3: Name your repository git-assignment. Step 4: Leave it as "Public". Step 5: ⚠️ CRITICAL: Do NOT check the box that says "Add a README file". Leave it completely blank. Step 6: Click the green "Create repository" button.


Phase 5: Upload (Push) Your Project to GitHub

GitHub will now show you a page with some code snippets. We are going to connect your local folder to this web folder.

Step 1: Go back to your Git Bash window. Step 2: Ensure your main branch is named main (the new standard) by typing:

git branch -M main

Step 3: Link your local folder to GitHub. Copy the command GitHub gave you that starts with git remote add origin and paste it into Git Bash. It will look something like this:

git remote add origin https://github.com/YOUR-USERNAME/git-assignment.git

Step 4: Upload ("push") your code to GitHub:

git push -u origin main

(Note: Because this is your first time, a small Windows pop-up might appear asking you to sign into GitHub. Click "Sign in with your browser" and authorize it.)


Phase 6: Verify and Submit

Step 1: Go back to your web browser where your GitHub repository page is open. Step 2: Refresh the page. Step 3: You should no longer see the setup instructions. Instead, you will see your README.md file with the text "Hello GitHub! This is my first repository." displayed on the screen.

📝 How to Submit Your Assignment: Copy the URL of your GitHub repository from your browser's address bar (it will look like https://github.com/YourUsername/git-assignment) and paste it into the assignment submission portal.


💡 Pro-Tips for the Student:

  • Pasting in Git Bash: You cannot use Ctrl+V to paste in Git Bash. Instead, right-click inside the black window and click Paste (or use Shift + Insert).
  • The Git Cycle: Every time you edit your project in the future, you will repeat these three commands to update GitHub:
    1. git add . (adds all new changes)
    2. git commit -m "Your message here" (saves the changes locally)
    3. git push (uploads the changes to GitHub)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment