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

  1. Go to GitHub.com and sign in
  2. Click the "+" icon in the top right corner
  3. Select "New repository"
  4. Enter a repository name
  5. Choose public or private
  6. Optionally add a README, .gitignore, or license
  7. 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