Turing Guild Labs

Back to course

Lab

Lab: Create Your First GitHub Repository

Submit this lab

Lab: Create Your First GitHub Repository

Objective

Set up Git basics for this course, create your first local Git repository, push it to GitHub, and submit the repository URL.

Success Criteria

  • Verify that git and gh are installed.
  • Confirm or set your global Git name and email.
  • Create a new lab folder named git-github-first-repo.
  • Initialize a Git repository.
  • Create a project .gitignore file before your first commit.
  • Create and commit a simple notes.md file.
  • Make one additional change and create a second commit.
  • Create a public GitHub repository with gh repo create.
  • Push your commits to GitHub.
  • Submit the GitHub repository URL.

Instructions

  1. Read the Git and GitHub primer.

Use the primer linked in this module as your reference. This lab only asks you to practice the smallest useful workflow.

  1. Check that Git and GitHub CLI are available.
git --version
gh --version

If either command is missing, ask your instructor for help before continuing.

  1. Check your Git identity.
git config --global user.name
git config --global user.email

If either command prints nothing, set your name and email:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
  1. Check that GitHub CLI is logged in.
gh auth status

If you are not logged in, run:

gh auth login

Follow the prompts in the browser.

  1. Create your lab folder.
mkdir -p ~/labs
cd ~/labs
mkdir git-github-first-repo
cd git-github-first-repo
  1. Initialize Git.
git init
  1. Create this repository's .gitignore file.

Every lab repository should include its own .gitignore before your first commit. This file tells Git which local files should not be committed or pushed to GitHub.

cat > .gitignore <<'EOF'
node_modules
.env
.DS_Store
Thumbs.db
EOF
  1. Verify that .gitignore exists.
ls -a
cat .gitignore

You should see .gitignore, and it should include node_modules.

  1. Create your first file.
echo "# My First GitHub Repository" > notes.md
echo "" >> notes.md
echo "Git saves checkpoints. GitHub stores pushed commits online." >> notes.md
  1. Check what Git sees.
git status

You should see .gitignore and notes.md ready to be added.

  1. Make your first commit.
git add .
git commit -m "Create first GitHub practice notes"
git branch -M main
  1. Make one more change.
echo "" >> notes.md
echo "I created a .gitignore before my first commit." >> notes.md
  1. Make your second commit.
git status
git add .
git commit -m "Add Git ignore note"
  1. Check your commit history.
git log --oneline

You should see two commits.

  1. Create a public GitHub repository and push your work.
gh repo create git-github-first-repo --public --source=. --remote=origin --push
  1. Verify the GitHub remote.
git remote -v
  1. Open the repository in your browser.
gh repo view --web

Required Deliverables

Your GitHub repository must include:

  • notes.md
  • .gitignore
  • at least two commits
  • a public GitHub repository URL

Submit Your Lab With GitHub

Open your repository in the browser:

gh repo view --web

Copy the GitHub repository URL from your browser and submit that URL with your lab submission.