270 lines
5.1 KiB
Markdown
270 lines
5.1 KiB
Markdown
# 🦊 Gitea Setup Guide
|
|
|
|
Complete guide to push your LemonLink project to your Gitea instance.
|
|
|
|
---
|
|
|
|
## 📋 What I Need From You
|
|
|
|
To help you set up the repository, please provide:
|
|
|
|
1. **Gitea URL** - e.g., `https://git.yourdomain.com` or `https://gitea.lemonlink.eu`
|
|
2. **Your username** - e.g., `lemonadmin`
|
|
3. **Repository name** - e.g., `lemonlink-website` or `landing-page`
|
|
4. **Access method**: SSH key or HTTPS with token?
|
|
|
|
---
|
|
|
|
## 🚀 Method 1: Create Repo via Web UI (Easiest)
|
|
|
|
### Step 1: Create Repository in Gitea
|
|
|
|
1. Log into your Gitea: `https://your-gitea.com`
|
|
2. Click **+** → **New Repository**
|
|
3. Fill in:
|
|
- **Owner**: Your username/organization
|
|
- **Repository Name**: `lemonlink` (or your preference)
|
|
- **Description**: "Jaw-dropping landing page for my homelab"
|
|
- **Visibility**: ☑️ Make it private (or public if you want)
|
|
- **Initialize**: ☐ Uncheck "Initialize Repository" (we'll push existing files)
|
|
4. Click **Create Repository**
|
|
|
|
### Step 2: Push Your Code
|
|
|
|
Open terminal/command prompt in your project folder and run:
|
|
|
|
```bash
|
|
# Initialize Git (if not already done)
|
|
git init
|
|
|
|
# Add all files
|
|
git add .
|
|
|
|
# First commit
|
|
git commit -m "Initial commit: Jaw-dropping landing page 🍋"
|
|
|
|
# Add Gitea remote (replace with your info)
|
|
git remote add origin https://your-gitea.com/username/lemonlink.git
|
|
|
|
# Push to Gitea
|
|
git push -u origin main
|
|
```
|
|
|
|
---
|
|
|
|
## 🔐 Method 2: Using SSH Keys
|
|
|
|
### Step 1: Generate SSH Key (if you don't have one)
|
|
|
|
```bash
|
|
# Generate key
|
|
ssh-keygen -t ed25519 -C "your-email@example.com"
|
|
|
|
# Copy public key
|
|
cat ~/.ssh/id_ed25519.pub
|
|
```
|
|
|
|
### Step 2: Add Key to Gitea
|
|
|
|
1. Gitea → User Settings → SSH / GPG Keys
|
|
2. Click **Add SSH Key**
|
|
3. Paste your public key
|
|
4. Click **Add Key**
|
|
|
|
### Step 3: Push with SSH
|
|
|
|
```bash
|
|
# Use SSH URL
|
|
git remote add origin git@your-gitea.com:username/lemonlink.git
|
|
git push -u origin main
|
|
```
|
|
|
|
---
|
|
|
|
## 🔑 Method 3: Using HTTPS with Access Token
|
|
|
|
### Step 1: Create Access Token
|
|
|
|
1. Gitea → User Settings → Applications
|
|
2. Generate New Token
|
|
3. Name: "LemonLink Development"
|
|
4. Permissions: ☑️ repo (full access)
|
|
5. Click **Generate Token**
|
|
6. **COPY THE TOKEN** (you can't see it again!)
|
|
|
|
### Step 2: Push with Token
|
|
|
|
```bash
|
|
# Use token in URL (replace YOUR_TOKEN)
|
|
git remote add origin https://YOUR_TOKEN@your-gitea.com/username/lemonlink.git
|
|
|
|
git push -u origin main
|
|
```
|
|
|
|
Or use credential helper:
|
|
```bash
|
|
git config --global credential.helper cache
|
|
git push -u origin main
|
|
# Enter username and token as password
|
|
```
|
|
|
|
---
|
|
|
|
## 🔄 Keeping Gitea in Sync
|
|
|
|
After making changes:
|
|
|
|
```bash
|
|
# Stage changes
|
|
git add .
|
|
|
|
# Commit
|
|
git commit -m "Description of changes"
|
|
|
|
# Push to Gitea
|
|
git push origin main
|
|
```
|
|
|
|
---
|
|
|
|
## 🏷️ Tagging Releases
|
|
|
|
```bash
|
|
# Create version tag
|
|
git tag -a v1.0.0 -m "First stable release"
|
|
|
|
# Push tags
|
|
git push origin --tags
|
|
```
|
|
|
|
---
|
|
|
|
## 🎨 Gitea Features to Enable
|
|
|
|
In your Gitea repository settings:
|
|
|
|
### Issues
|
|
- Enable for bug reports and feature requests
|
|
|
|
### Wiki
|
|
- Enable for extended documentation
|
|
|
|
### Projects
|
|
- Enable for Kanban-style project management
|
|
|
|
### Actions (CI/CD)
|
|
If your Gitea has Actions enabled, you can add `.gitea/workflows/deploy.yml`:
|
|
|
|
```yaml
|
|
name: Deploy to Server
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Deploy to server
|
|
run: |
|
|
# Add your deployment commands here
|
|
echo "Deployed!"
|
|
```
|
|
|
|
---
|
|
|
|
## 📱 Cloning on Other Machines
|
|
|
|
Once in Gitea, clone anywhere:
|
|
|
|
```bash
|
|
# HTTPS
|
|
git clone https://your-gitea.com/username/lemonlink.git
|
|
|
|
# SSH
|
|
git clone git@your-gitea.com:username/lemonlink.git
|
|
```
|
|
|
|
---
|
|
|
|
## 🌐 Gitea + Docker Integration
|
|
|
|
If your Gitea and Docker are on the same VM, you can automate deployment:
|
|
|
|
### Option 1: Gitea Webhook
|
|
|
|
1. Gitea → Repository Settings → Webhooks
|
|
2. Add Gitea Webhook
|
|
3. Target URL: `http://localhost:9000/hooks/deploy` (your deployment endpoint)
|
|
4. Trigger on: Push events
|
|
|
|
### Option 2: Git Pull in Container
|
|
|
|
```bash
|
|
# SSH into Docker VM
|
|
cd /opt/lemonlink
|
|
git pull origin main
|
|
# Files update instantly!
|
|
```
|
|
|
|
### Option 3: Watchtower (Auto-update)
|
|
|
|
If using Docker image from Gitea Registry:
|
|
|
|
```yaml
|
|
version: '3.8'
|
|
services:
|
|
watchtower:
|
|
image: containrrr/watchtower
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
command: --interval 30 --cleanup
|
|
```
|
|
|
|
---
|
|
|
|
## 🛠️ Troubleshooting
|
|
|
|
### "Permission denied"
|
|
```bash
|
|
# Check remote URL
|
|
git remote -v
|
|
|
|
# Fix permissions on SSH key
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
```
|
|
|
|
### "Repository not found"
|
|
- Verify repository exists in Gitea
|
|
- Check username/repo name spelling
|
|
- Ensure you have access permissions
|
|
|
|
### "Failed to push"
|
|
```bash
|
|
# Force push (careful!)
|
|
git push -f origin main
|
|
|
|
# Or pull first
|
|
git pull origin main
|
|
git push origin main
|
|
```
|
|
|
|
---
|
|
|
|
## ✨ Quick Reference
|
|
|
|
| Command | Description |
|
|
|---------|-------------|
|
|
| `git status` | Check current state |
|
|
| `git add .` | Stage all changes |
|
|
| `git commit -m "msg"` | Commit changes |
|
|
| `git push` | Push to Gitea |
|
|
| `git pull` | Get latest changes |
|
|
| `git log` | View commit history |
|
|
|
|
---
|
|
|
|
**Ready?** Give me your Gitea details and I'll generate the exact commands for you! 🚀
|