Creating a Repository
A repository (repo) is one project: its files plus their complete history. You can create one on GitHub in a minute.
On this page · 5 min · Beginner
On this page
- Learning objectives
- Explanation
- Step-by-step screens
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Beginner
- Updated
- Nov 25, 2026
Learning objectives#
- Create a repository on github.com
- Choose between public and private
- Decide when to add a README, .gitignore and licence
- Find your way around the repository page
Explanation#
Click + (top right) → New repository. Give it a short, lowercase name with hyphens, such as hello-github. The description is optional but helps people (and search) understand it.
Public repositories can be seen by anyone — ideal for learning projects and your portfolio. Private ones are visible only to you and the people you invite. You can switch later in Settings.
For a brand-new project, tick Add a README file so the repository is not empty and you can clone it straight away. Add a .gitignore template for your language (Node, VisualStudio, Python…) and a licence such as MIT if you want others to be able to reuse the code. If you are uploading a project that already exists on your computer, leave all three unticked.
The repository page shows the files, the README underneath, the branch selector, and tabs for Issues, Pull requests, Actions and Settings.
Step-by-step screens#
Drawings of github.com, the Git installer, VS Code and a terminal. GitHub changes its layout from time to time; the button names stay the same. The red numbers match the numbered actions under each picture; names on your computer will differ.
Loading pictures…
Code example: The same thing with the GitHub CLI#
gh auth login # once
gh repo create hello-github --public --add-readme --clone
cd hello-github
git log --oneline
✓ Created repository asha/hello-github on GitHub Cloning into 'hello-github'... 1a2b3c4 Initial commit
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- gh auth login connects the CLI to your account.
- gh repo create makes the repository with a README.
- --clone downloads it immediately.
- The first commit (“Initial commit”) contains the README.
Real-world use case#
For each new college assignment a student creates a private repository with a Node .gitignore, so node_modules never gets uploaded.
Common mistakes#
GitHub then has a commit your computer doesn’t, and the first push is rejected. Create it empty, or pull first.
GitHub turns “My Project” into My-Project; short lowercase-with-hyphens names are easier to type and read.
Best practices#
- One repository per project
- lowercase-with-hyphens names
- Always have a README
- Pick the .gitignore template for your language
Remember this#
+ → New repository.
New project: tick README. Existing project: leave it empty.
Public = portfolio, private = just you.
Practice exercise#
Your task: Write the HTTPS clone URL for the repository hello-github owned by asha.
Show solution
https://github.com/asha/hello-github.git
Mini quiz#
You already have a project on your computer. What should you tick when creating the GitHub repository?
Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions
My notes#
Saved in this browser.