Git — Create Repository
New Repository
# Create directory
mkdir my-project
cd my-project
# Initialize Git
git init
# Verify
ls -la # Shows .git directory
Existing Directory
cd existing-project
git init
git add .
git commit -m "Initial commit"
.gitignore
# Create .gitignore
touch .gitignore
# .gitignore
node_modules/
.env
*.log
dist/
.DS_Store
README.md
# My Project
Description of the project.
## Installation
npm install
## Usage
npm start
First Commit
git add .
git commit -m "Initial commit"
Remote Repository
# Add remote
git remote add origin https://github.com/user/repo.git
# Push to remote
git push -u origin main
Mini Practice
- Create a new repository
- Add .gitignore
- Create README.md
- Make first commit
Up Next
Continue with Clone — cloning repositories.
Related Topics
Frequently Asked Questions about Create Repository
What is Create Repository in Git?
Create Repository is a fundamental concept in Git. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Create Repository?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Create Repository.
Why is Create Repository important in Git?
Create Repository is essential for Git development. Understanding this concept will help you write better code and solve real-world problems more effectively.