GitHub Setup and Push Guide
Follow these steps to push your strawberry picker ML project to GitHub.
Prerequisites
Git installed on your system
git --versionGitHub account (create at https://github.com if you don't have one)
Git configured with your credentials
git config --global user.name "Your Name" git config --global user.email "your.email@example.com"
Step 1: Create GitHub Repository
Option A: Using GitHub Website (Recommended)
- Go to https://github.com/new
- Repository name:
strawberry-picker-robot - Description:
Machine learning vision system for robotic strawberry picking - Choose: Public or Private
- Check: Add a README file (we'll overwrite it)
- Click: Create repository
Option B: Using GitHub CLI (if installed)
gh repo create strawberry-picker-robot --public --source=. --remote=origin --push
Step 2: Initialize Local Repository
Open terminal in your project folder:
cd "G:\My Drive\University Files\5th Semester\Kinematics and Dynamics\strawberryPicker"
Initialize git repository:
git init
Step 3: Add Files to Git
Add all files (except those in .gitignore):
git add .
Check what will be committed:
git status
You should see files like:
requirements.txttrain_yolov8.pytrain_yolov8_colab.ipynbsetup_training.pyTRAINING_README.mdREADME.md.gitignoreArduinoCode/assets/
Step 4: Create First Commit
git commit -m "Initial commit: YOLOv8 training pipeline for strawberry detection
- Add YOLOv8 training scripts (local, Colab, WSL)
- Add environment setup and validation
- Add comprehensive training documentation
- Add .gitignore for ML project
- Support multiple training environments"
Step 5: Connect to GitHub Repository
If you created repo on GitHub website, link it:
git remote add origin https://github.com/YOUR_USERNAME/strawberry-picker-robot.git
Replace YOUR_USERNAME with your actual GitHub username.
Step 6: Rename Default Branch (if needed)
git branch -M main
Step 7: Push to GitHub
First push (sets up remote tracking):
git push -u origin main
Enter your GitHub credentials when prompted.
Step 8: Verify Push
Go to https://github.com/YOUR_USERNAME/strawberry-picker-robot You should see all your files!
Step 9: Add .gitignore for Large Files
If you want to add dataset or large model files later, use Git LFS:
# Install Git LFS
git lfs install
# Track large file types
git lfs track "*.pt"
git lfs track "*.onnx"
git lfs track "*.tflite"
git lfs track "*.h5"
# Add .gitattributes
git add .gitattributes
git commit -m "Add Git LFS tracking for large model files"
git push
Step 10: Create .gitattributes File
Create .gitattributes file in project root:
*.pt filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
Quick Push Commands (Summary)
# One-time setup
git init
git add .
git commit -m "Initial commit: YOLOv8 training pipeline"
git remote add origin https://github.com/YOUR_USERNAME/strawberry-picker-robot.git
git branch -M main
git push -u origin main
# Future updates
git add .
git commit -m "Your commit message"
git push
Troubleshooting
Authentication Issues
If you get authentication errors:
Option 1: Use Personal Access Token
- Go to GitHub Settings → Developer settings → Personal access tokens
- Generate new token (classic) with
reposcope - Use token as password when prompted
Option 2: Use SSH (Recommended)
# Check if SSH key exists
ls ~/.ssh/id_rsa.pub
# If not, create one
ssh-keygen -t rsa -b 4096 -C "your.email@example.com"
# Add to GitHub
cat ~/.ssh/id_rsa.pub
# Copy output and add to GitHub → Settings → SSH and GPG keys
# Change remote to SSH
git remote set-url origin git@github.com:YOUR_USERNAME/strawberry-picker-robot.git
Large File Issues
If files are too large for GitHub (max 100MB):
- Use Git LFS (see Step 9)
- Or add to
.gitignoreand upload separately to Google Drive/Dropbox
Proxy Issues (if behind firewall)
git config --global http.proxy http://proxy.company.com:8080
git config --global https.proxy https://proxy.company.com:8080
Best Practices
Commit Messages
Write clear, descriptive commit messages:
git commit -m "Add YOLOv8 training script with Colab support
- Auto-detects training environment
- Supports local, WSL, and Google Colab
- Includes dataset validation
- Exports to ONNX format"
Branching Strategy
# Create feature branch
git checkout -b feature/add-ripeness-detection
# Work on changes
git add .
git commit -m "Add ripeness classification dataset collection"
# Push branch
git push -u origin feature/add-ripeness-detection
# Create pull request on GitHub
Regular Pushes
Push frequently to avoid losing work:
# Daily push
git add .
git commit -m "Training progress: epoch 50/100, loss: 0.123"
git push
GitHub Repository Settings
Protect Main Branch
- Go to Settings → Branches
- Add rule for
mainbranch:- Require pull request reviews
- Require status checks
- Include administrators
Add Description and Topics
- Go to repository page
- Click "Edit" next to description
- Add topics:
machine-learning,yolov8,raspberry-pi,robotics,computer-vision
Enable Issues and Projects
- Use Issues to track bugs and features
- Use Projects to organize development phases
Continuous Integration (Optional)
Add .github/workflows/train.yml for automated training:
name: Train Model
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
train:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Validate dataset
run: |
python train_yolov8.py --validate-only
Next Steps After Push
- Share repository with teammates/collaborators
- Create issues for Phase 2, 3, 4 tasks
- Set up project board to track progress
- Add documentation to wiki if needed
- Enable GitHub Pages for documentation (optional)
Getting Help
- GitHub Docs: https://docs.github.com
- Git Cheat Sheet: https://education.github.com/git-cheat-sheet-education.pdf
- Git LFS Docs: https://git-lfs.github.com
Repository URL
Your repository will be at:
https://github.com/YOUR_USERNAME/strawberry-picker-robot
Clone Command (for others)
git clone https://github.com/YOUR_USERNAME/strawberry-picker-robot.git
cd strawberry-picker-robot
pip install -r requirements.txt
Ready to push? Run the commands in Step 1-7 above!