homarr-dashboard/SETUP_GITEA.md

158 lines
2.9 KiB
Markdown

# 🔗 Connect to Gitea Repository
## Step 1: Create Repository in Gitea
1. Go to `https://gitea.lemonlink.eu`
2. Create organization: `homelab` (if not exists)
3. Create repository: `homarr-dashboard`
4. **Do NOT initialize with README** (we already have one)
## Step 2: Add Remote and Push
Run these commands from the `homarr-deploy` directory:
```bash
# HTTPS (easier, requires username/password)
git remote add origin https://gitea.lemonlink.eu/homelab/homarr-dashboard.git
# OR SSH (requires SSH key setup)
# git remote add origin git@gitea.lemonlink.eu:homelab/homarr-dashboard.git
# Push to Gitea
git push -u origin master
# OR if Gitea uses 'main' as default:
# git push -u origin main
```
## Step 3: Verify
Check your Gitea repository at:
`https://gitea.lemonlink.eu/homelab/homarr-dashboard`
You should see all files: README.md, docker-compose.yml, config/, etc.
---
## 🚀 Deploy on Your Server
SSH into your server and run:
```bash
# 1. Create directory
mkdir -p /opt/homelab
cd /opt/homelab
# 2. Clone from Gitea
git clone https://gitea.lemonlink.eu/homelab/homarr-dashboard.git
# OR with SSH:
# git clone git@gitea.lemonlink.eu:homelab/homarr-dashboard.git
cd homarr-dashboard
# 3. Configure environment
cp .env.example .env
nano .env # Edit with your domain, secrets, etc.
# 4. Ensure NPM network exists
docker network create npm-network 2>/dev/null || echo "Network already exists"
# 5. Deploy
chmod +x deploy.sh
./deploy.sh
```
---
## 🔄 Future Updates
To update your deployment:
```bash
cd /opt/homelab/homarr-dashboard
./update.sh
```
Or manually:
```bash
cd /opt/homelab/homarr-dashboard
git pull
docker compose pull
docker compose up -d
```
---
## 📝 Making Changes
### Local Development
```bash
# Edit files locally
cd homarr-deploy
# ... make changes ...
# Commit and push
git add .
git commit -m "Description of changes"
git push origin master
# Then on server, pull and update
ssh user@your-server
cd /opt/homelab/homarr-dashboard
./update.sh
```
### Using Gitea Web Interface
1. Edit files directly in Gitea
2. Commit changes
3. On server, run: `./update.sh`
---
## 🆘 Troubleshooting
### Issue: Cannot push to Gitea
```bash
# Check remote
git remote -v
# If wrong, remove and re-add
git remote remove origin
git remote add origin https://gitea.lemonlink.eu/homelab/homarr-dashboard.git
# Try push with verbose
git push -v origin master
```
### Issue: Authentication failed
For HTTPS, you need to enter your Gitea username and password.
To cache credentials:
```bash
git config --global credential.helper cache
# Or store (less secure):
# git config --global credential.helper store
```
For SSH, ensure your key is added:
```bash
cat ~/.ssh/id_rsa.pub
# Copy and paste to Gitea → User Settings → SSH Keys
```
### Issue: Branch name mismatch
If Gitea uses `main` but local is `master`:
```bash
# Rename local branch
git branch -m main
# Push
git push -u origin main
```