Mohatta
← Cheatsheets

Start a New Project with Git and GitHub (In Progress)

Updated December 2, 2026 · DevOps

🚧 Status: in progress. I will update this cheatsheet regularly with new commands.

Replace <username> with your GitHub username and <repo> with your project name.

1. Create a GitHub account

Tip

Already have a GitHub account? Skip this step.

  1. Sign up at https://github.com/signup.
  2. Verify your email address.
  3. Turn on two-factor authentication: Settings → Password and authentication → Enable two-factor authentication. Save the recovery codes.
  4. Optional: to hide your real email in commits, go to Settings → Emails and select Keep my email addresses private. Also select Block command line pushes that expose my email. There you will see your noreply address, such as 00000000+mohattadev@users.noreply.github.com.

Warning

If you don’t hide your email, anyone can see your real email in your public commits and could use it for spam or phishing. Changing the setting later doesn’t change old commits.

How can people see it? Open a commit on GitHub and add .patch to the end of the address. The From: line shows the email.

General:

https://github.com/<username>/<repo>/commit/<commit-id>.patch

Result:

From: <name> <email>

Sample:

https://github.com/mohattadev/mohatta-dotnet-starter-kit/commit/1234567.patch

Result:

From 1234567 Mon Sep 17 00:00:00 2001
From: Mohatta <mohatta@example.com>
Date: Wed, 2 Dec 2026 09:30:00 +0700
Subject: [PATCH] docs: update README

Anyone who clones the repository can also see it with git log. Check your own commits this way.

2. Create a repository on GitHub

Tip

Already have a repository? Skip this step.

  1. Click + at the top right, then New repository.
  2. Enter a repository name and description.
  3. Choose Public, or Private if you are not ready to show it.
  4. Add a README, a .gitignore template and a license.
  5. Click Create repository.
File What it is for Without it
README.md The front page of your repository. It says what the project is, its status and how to run it Visitors see only a list of files
.gitignore Lists files Git should not save, such as build output, downloaded packages and local settings Unneeded or private files can be committed by mistake
LICENSE Says how others may use your code. MIT allows use, change and sharing if they keep your copyright notice Others have no clear permission to reuse your code, even if the repository is public

Learn about licenses at Choose a License, a well-known guide maintained by GitHub, or read about the MIT License.

Sample:

Add topics. Topics are tags that help people find your repository.

  1. Open your repository’s main page.
  2. Click the gear icon next to About on the right.
  3. In Topics, type a topic and press Enter. Repeat for each topic.
  4. Click Save changes. Your topics show under the description.

Use lowercase letters, numbers or hyphens, such as starter-kit.

3. Install Git

Tip

Already have Git? Run git --version to check, then skip the install.

Download Git from https://git-scm.com/downloads, install it once per computer, then check:

git --version

Sample result (your version number may be different):

git version 2.56.1.windows.1

4. Set name and email

Use the details from your GitHub account.

Note

Did you hide your email in step 1? Use your noreply address here. You can find it in Settings → Emails on GitHub.

General:

git config --global user.name "<your name>"
git config --global user.email "<your GitHub email>"
git config --global init.defaultBranch main

Sample:

git config --global user.name "Mohatta"
git config --global user.email "00000000+mohattadev@users.noreply.github.com"
git config --global init.defaultBranch main

What are the name and email for? Git saves them in every commit as the author, to show who made the change. They are not used to sign in.

init.defaultBranch main names the first branch of new projects main.

5. Clone the repository

This copies your GitHub repository to your computer.

General:

git clone https://github.com/<username>/<repo>.git
cd <repo>

Sample:

git clone https://github.com/mohattadev/mohatta-dotnet-starter-kit.git
cd mohatta-dotnet-starter-kit

6. Commit

A commit saves a snapshot of your changes on your computer, with a short message that says what changed. It is not on GitHub yet.

Edit your files first, for example update README.md.

Command What it does
git add . Adds all changes in the current folder (except ignored files)
git add <file> Adds one file, such as git add README.md
git add <file1> <file2> Adds several files, such as git add README.md LICENSE
git status Shows which files will be committed
git diff --staged Shows which lines will be committed
git commit -m "<message>" Saves the commit with your message
git add .
git status
git commit -m "docs: update README"

Commit messages

Following Conventional Commits is a best practice that makes commit messages easier to read. Write a type, a colon, then a short message.

Type Use for Example
feat A new feature feat: add sign-in page
fix A bug fix fix: correct token expiry check
docs Documentation only docs: update README
refactor Code change with no new behaviour refactor: split user service
test Tests test: add sign-in tests
chore Maintenance, such as packages or settings chore: update packages

7. Push

A push uploads your commits from your computer to GitHub. After that, others can see them if the repository is public.

Check for secrets first. Make sure your files have no passwords, API keys or tokens, then push:

git push

TagsGit GitHub