Project Deployment
GitHub Repository Setup
Create a GitHub repo
GitHub Repository Setup
GitHub is a code hosting platform that uses Git for version control. Setting up a GitHub repository is essential for collaboration and deployment.
Create a New Repository
- Go to GitHub.com and sign in
- Click the "+" icon in the top right corner
- Select "New repository"
- Enter a repository name
- Choose public or private
- Optionally add a README, .gitignore, or license
- Click "Create repository"
Connect Local Repository to GitHub
If you already have a local Git repository:
# Add remote repository
git remote add origin https://github.com/username/repo-name.git
# Verify remote
git remote -v
# Push to GitHub
git branch -M main
git push -u origin main
Clone a Repository
To get a copy of a repository on your local machine:
git clone https://github.com/username/repo-name.git
cd repo-name
Create .gitignore
Create a .gitignore file to exclude files from version control:
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
.env
# Django
*.log
local_settings.py
db.sqlite3
# IDE
.vscode/
.idea/
*.swp
*.swo
Repository Best Practices
- Write clear commit messages
- Use branches for features
- Keep README.md updated
- Add meaningful descriptions
- Use issues and pull requests