Creating Repositories on GitHub
There are several ways to create repositories on GitHub. This lesson covers all the methods and options.
Creating a New Repository
Via Web Interface
- Click the + button in the top right
- Select New repository
- Fill in the details:
| Field | Description |
|---|---|
| Repository name | URL-friendly name (e.g., my-project) |
| Description | Brief explanation (optional) |
| Visibility | Public or Private |
| Initialize | Add README, .gitignore, license |
Repository Naming
Good names are:
- Lowercase with hyphens:
my-awesome-project - Descriptive:
react-todo-app - Concise:
blog-api
Avoid:
- Spaces (use hyphens instead)
- Special characters
- Generic names like
project1
Initialization Options
README.md
A README is the first thing visitors see:
# Project Name
Brief description of what this project does.
## Installation
```bash
npm install my-project
Usage
const myProject = require('my-project');
myProject.doSomething();
License
MIT
### .gitignore
Automatically exclude files from Git:
Node
node_modules/ npm-debug.log
Environment
.env .env.local
Build
dist/ build/
IDE
.vscode/ .idea/
GitHub provides templates for different languages/frameworks.
### License
Common licenses:
| License | Description |
|---------|-------------|
| **MIT** | Do anything, keep license notice |
| **Apache 2.0** | MIT + patent protection |
| **GPL v3** | Derivatives must also be open source |
| **BSD** | Similar to MIT |
| **Unlicense** | Public domain |
Choose carefully—it affects how others can use your code.
## Creating from Existing Project
### Push Existing Local Repo
If you have a local Git repository:
```bash
# Create empty repo on GitHub (no README/gitignore)
# Add remote
git remote add origin https://github.com/username/repo.git
# Push
git push -u origin main
Using GitHub CLI
# Create and push in one step
gh repo create my-project --public --source=. --push
Import from Another Service
GitHub can import from:
- GitLab
- Bitbucket
- Other Git hosts
Go to: github.com/new/import
Creating from Template
Using Template Repositories
Some repos are marked as templates:
- Go to template repository
- Click "Use this template"
- Choose "Create a new repository"
- Name your new repo
Your repo will have the same files but a fresh Git history.
Making Your Repo a Template
Settings → General → Check "Template repository"
Repository Settings
After Creation
Navigate to Settings tab:
| Setting | Purpose |
|---|---|
| General | Name, visibility, features |
| Collaborators | Add team members |
| Branches | Protection rules |
| Pages | Host static website |
| Secrets | Environment variables for Actions |
Branch Protection
Protect important branches:
Branch: main
Rules:
✓ Require pull request before merging
✓ Require approvals: 1
✓ Require status checks to pass
✓ Require branches to be up to date
Features to Enable/Disable
- Issues
- Wiki
- Projects
- Discussions
- Sponsorship
Repository Visibility
Changing Visibility
Settings → General → Danger Zone → Change visibility
⚠️ Warning: Making a private repo public exposes all history!
Visibility Options
| Option | Use Case |
|---|---|
| Public | Open source, portfolio projects |
| Private | Work projects, sensitive code |
Working with the New Repository
Clone to Local
# HTTPS
git clone https://github.com/username/repo.git
# SSH
git clone git@github.com:username/repo.git
# GitHub CLI
gh repo clone username/repo
Initial Setup After Clone
cd repo
# Verify remote
git remote -v
# Start working
git checkout -b feature
# ... make changes ...
git commit -m "Add feature"
git push -u origin feature
Creating Organization Repositories
For teams/companies:
- Switch to organization context
- Create repository as usual
- Set team access:
- Admin
- Maintain
- Write
- Triage
- Read
Repository Best Practices
Include These Files
├── README.md # Project documentation
├── LICENSE # How others can use it
├── .gitignore # Files to exclude
├── CONTRIBUTING.md # How to contribute
├── CODE_OF_CONDUCT.md # Community guidelines
├── CHANGELOG.md # Version history
└── .github/
├── ISSUE_TEMPLATE/
├── PULL_REQUEST_TEMPLATE.md
└── workflows/ # GitHub Actions
Good README Structure
- Title and badges
- Description: What, why
- Installation: How to set up
- Usage: Basic examples
- API/Documentation: Link or details
- Contributing: How to help
- License: Legal terms
Archiving and Deleting
Archive
Settings → Danger Zone → Archive
- Makes repo read-only
- Keeps all history
- Good for deprecated projects
Delete
Settings → Danger Zone → Delete
- ⚠️ Permanent - cannot be undone
- Type repo name to confirm
Summary
- Create repos via web, CLI, or import
- Initialize with README, .gitignore, and LICENSE
- Use templates for common project structures
- Configure branch protection for important branches
- Include essential files (README, LICENSE, etc.)
- Choose visibility carefully (public/private)
In the next lesson, we'll learn about cloning and forking repositories.

