IT & Technology tutorial

Git and GitHub: Your First Repository

Track changes with Git, make commits and push a project to GitHub, with the commands in the order you use them.

  • Beginner
  • 2 min read
  • Free

Git tracks every change to your project so you can review history and undo mistakes. GitHub hosts Git repositories online so you can back them up, share them and collaborate.

One-time setup

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Start tracking a project

cd my-project
git init                  # create a repository
git status                # see what changed
git add .                 # stage all changes
git commit -m "First commit"

Put it on GitHub

  1. Create an empty repository on github.com.
  2. Connect your local project and push:
git branch -M main
git remote add origin https://github.com/your-name/my-project.git
git push -u origin main

The everyday loop

git add .
git commit -m "Describe what you changed"
git push

Working on a branch

git switch -c new-feature   # create and switch to a branch
# ...edit and commit...
git push -u origin new-feature

Then open a pull request on GitHub to review and merge the branch.

Tip: commit small, focused changes with clear messages. Never commit passwords or API keys; list secret files in .gitignore.

Want a live class on this?

An advisor will call you within one business day to recommend a course and a batch that fits your schedule.

  1. An advisor calls you within one business day.
  2. You talk through your background and goals for about 20 minutes.
  3. You get a recommended program and batch, with no obligation to enroll.
info@stratedgeitconsulting.com +1 (302) 434-8889 ext. 101 Monday to Saturday, 9 AM to 7 PM ET

Tell us about you

Takes about a minute. Fields marked optional can be skipped.

Enter your full name.
Enter an email address like name@example.com.
Enter a phone number so an advisor can call you.
Choose what you’re interested in.
Preferred batch
Tick the box so an advisor can contact you.

We use these details as described in our Privacy Policy. By submitting, you agree to our Terms and Conditions.