Files
inventree-stock-tool/GITEA_SETUP.md

4.7 KiB

Pushing to Gitea - Setup Instructions

This guide will help you push the InvenTree Stock Tool repository to your internal Gitea server.

Prerequisites

  • Git installed on your machine
  • Access to your internal Gitea server
  • Gitea account with repository creation permissions

Step 1: Create Repository on Gitea

  1. Log into your Gitea instance
  2. Click the + button (top right) or go to New Repository
  3. Fill in the repository details:
    • Repository Name: inventree-stock-tool (or your preferred name)
    • Description: "Barcode scanning application for InvenTree inventory management"
    • Visibility: Choose Private or Public as appropriate
    • Initialize Repository: Leave UNCHECKED (we already have a repo)
  4. Click Create Repository

Step 2: Add Gitea as Remote

After creating the repository, Gitea will show you the repository URL. It will look something like:

https://gitea.yourcompany.com/username/inventree-stock-tool.git

Add this as a remote to your local repository:

cd "C:\Users\berwn\Desktop\barcodes\stocktool"

# Add Gitea as remote origin
git remote add origin https://gitea.yourcompany.com/username/inventree-stock-tool.git

# Verify the remote was added
git remote -v

Step 3: Push to Gitea

Push your code to the Gitea server:

# Push master branch to origin
git push -u origin master

You may be prompted for your Gitea username and password.

Alternative: Using SSH

If you prefer SSH over HTTPS:

  1. Add your SSH key to Gitea (Settings > SSH Keys)
  2. Use the SSH URL instead:
    git remote add origin git@gitea.yourcompany.com:username/inventree-stock-tool.git
    git push -u origin master
    

Step 4: Verify Upload

  1. Go to your Gitea repository in your browser
  2. You should see all files:
    • stock_tool_gui_v2.py
    • README.md
    • FIXES_APPLIED.md
    • .gitignore
    • example_config.yaml
    • Test files
  3. The README should be displayed on the repository homepage

Step 5: Setup Repository Settings (Optional)

Add Topics/Tags

In Gitea, add relevant topics to help others find the repository:

  • inventree
  • barcode-scanner
  • inventory-management
  • python
  • tkinter

If multiple people will be working on this:

  1. Go to Settings > Branches
  2. Add protection to master branch
  3. Enable "Require pull request reviews before merging"

Setup Collaborators

  1. Go to Settings > Collaborators
  2. Add team members who need access
  3. Set appropriate permissions (Read, Write, Admin)

Future Updates

After making changes to the code:

# Check what changed
git status

# Add changed files
git add stock_tool_gui_v2.py

# Commit with descriptive message
git commit -m "Fix: Corrected API endpoint for stock updates"

# Push to Gitea
git push origin master

Quick Reference Commands

# Clone from Gitea (for other team members)
git clone https://gitea.yourcompany.com/username/inventree-stock-tool.git

# Pull latest changes
git pull origin master

# Create a new branch for features
git checkout -b feature/new-feature
git push -u origin feature/new-feature

# View commit history
git log --oneline

# View repository info
git remote show origin

Troubleshooting

Authentication Issues

If you have trouble authenticating:

  • HTTPS: Use personal access token instead of password (Settings > Applications > Generate Token)
  • SSH: Ensure your SSH key is added to Gitea

Push Rejected

If push is rejected:

# Pull changes first
git pull origin master --rebase

# Then push
git push origin master

Large Files Warning

The .gitignore is configured to exclude:

  • Python cache files
  • Virtual environments
  • Config files with credentials (*.yaml except example)
  • Log files

Repository Structure

inventree-stock-tool/
├── .gitignore                    # Git ignore rules
├── README.md                     # Main documentation
├── FIXES_APPLIED.md              # Bug fix documentation
├── GITEA_SETUP.md                # This file
├── example_config.yaml           # Example configuration
├── stock_tool_gui_v2.py          # Main application
├── test_add_stock.py             # Tests
├── test_duplicate_handling.py    # Tests
├── test_parse_fix.py             # Tests
└── test_stock_level.py           # Tests

Next Steps

  1. Share the repository URL with your team
  2. Update internal documentation with the Gitea link
  3. Set up any CI/CD pipelines if needed
  4. Consider adding issue templates for bug reports

Repository initialized and ready for Gitea!

Current commit: ab0d1ae - Initial commit: InvenTree Stock Tool v2