Files
appa-net/zet.home.arpa/git-server/QUICK-REFERENCE.md
2026-04-22 14:59:04 -05:00

212 lines
4.7 KiB
Markdown

# Git Server Quick Reference
Quick commands and tips for managing the Gitea git server on zet.home.arpa.
## Access
| What | URL/Command | Notes |
|------|-------------|-------|
| **Web Interface** | http://172.27.0.35:3000 | View repos, manage settings |
| **SSH Clone** | git@172.27.0.35:username/repo.git | Requires SSH key setup |
| **HTTPS Clone** | http://172.27.0.35:3000/username/repo.git | Public repos only |
| **API Base** | http://172.27.0.35:3000/api/v1 | Programmatic access |
| **Logs** | `journalctl -u gitea` | Service logs |
## Common Tasks
### Check Service Status
```bash
ssh zet "sudo systemctl status gitea"
```
### View Recent Logs
```bash
ssh zet "sudo journalctl -u gitea -n 30 --no-pager"
```
### Restart Gitea
```bash
ssh zet "sudo systemctl restart gitea"
```
### Check Memory Usage
```bash
ssh zet "ps aux | grep gitea | grep -v grep"
```
### List All Repositories (API)
```bash
curl http://172.27.0.35:3000/api/v1/repos/search
```
### Create New Repository (Web UI)
1. Visit http://172.27.0.35:3000
2. Click "+" in navigation
3. Select "New Repository"
4. Fill in repository details
5. Click "Create Repository"
### Clone a Repository
```bash
# Via HTTPS
git clone http://172.27.0.35:3000/kenjim/appa-net.git
# Via SSH (requires SSH key)
git clone git@172.27.0.35:kenjim/appa-net.git
```
### Push Changes (Requires Permission)
```bash
git push origin main
```
If you get "Permission denied", request push access through the web UI.
## Service Commands
### Manage Service
```bash
sudo systemctl start gitea # Start
sudo systemctl stop gitea # Stop
sudo systemctl restart gitea # Restart
sudo systemctl reload gitea # Reload config (if supported)
```
### Enable/Disable Auto-start
```bash
sudo systemctl enable gitea # Auto-start on boot
sudo systemctl disable gitea # Don't auto-start on boot
```
### View Service Unit File
```bash
cat /etc/systemd/system/gitea.service
```
## Monitoring
### Real-time Process Monitor
```bash
watch -n 2 'ps aux | grep gitea | grep -v grep'
```
### Disk Usage
```bash
du -sh /var/lib/gitea
du -sh /var/lib/gitea/repositories
```
### Live Logs
```bash
journalctl -u gitea -f
```
## Troubleshooting
### Service Won't Start
```bash
journalctl -u gitea -n 50 --no-pager # Check error messages
sudo systemctl status gitea --no-pager
```
### SSH Clone Not Working
```bash
# Test SSH connection
ssh -vvv git@172.27.0.35
# Verify your SSH key
cat ~/.ssh/id_rsa.pub
```
### HTTP Clone Fails
```bash
# Test web server
curl -I http://172.27.0.35:3000
curl -I http://172.27.0.35:3000/api/v1/version
```
### High Memory Usage
```bash
# Restart the service
sudo systemctl restart gitea
# Check if issue resolves
watch -n 2 'ps aux | grep gitea'
```
## Repository URLs
### Appa-net Repository
- **SSH**: git@172.27.0.35:kenjim/appa-net.git
- **HTTP**: http://172.27.0.35:3000/kenjim/appa-net.git
- **Web**: http://172.27.0.35:3000/kenjim/appa-net
### Dotfiles Repository
- **SSH**: git@172.27.0.35:kenjim/dotfiles.git
- **HTTP**: http://172.27.0.35:3000/kenjim/dotfiles.git
- **Web**: http://172.27.0.35:3000/kenjim/dotfiles
### Test Repository
- **SSH**: git@172.27.0.35:kenjim/test.git
- **HTTP**: http://172.27.0.35:3000/kenjim/test.git
- **Web**: http://172.27.0.35:3000/kenjim/test
## Useful Files
| Path | Purpose | Owner |
|------|---------|-------|
| `/usr/local/bin/gitea` | Gitea executable | root |
| `/etc/gitea/app.ini` | Configuration file | root |
| `/var/lib/gitea` | Data directory | git |
| `/var/lib/gitea/repositories` | Repository storage | git |
| `/etc/systemd/system/gitea.service` | Service definition | root |
| `/home/git` | Git user home | git |
## Configuration Location
**Config File**: `/etc/gitea/app.ini`
To view/edit:
```bash
sudo nano /etc/gitea/app.ini
sudo systemctl restart gitea # After changes
```
## API Authentication
Generate a personal access token in the web UI:
1. Visit http://172.27.0.35:3000/user/settings/applications
2. Create a new token
3. Use in API calls:
```bash
curl -H "Authorization: token YOUR_TOKEN" \
http://172.27.0.35:3000/api/v1/repos/search
```
## SSH Key Setup (If Needed)
To use SSH with Gitea:
```bash
# Generate key (if you don't have one)
ssh-keygen -t ed25519 -C "your-email@example.com"
# Add key to your Gitea account
# Visit: http://172.27.0.35:3000/user/settings/keys
# Click "Add Key" and paste your public key (~/.ssh/id_ed25519.pub)
# Test SSH access
ssh -T git@172.27.0.35
```
## Useful Links
- **Gitea Documentation**: https://docs.gitea.io/
- **Gitea Configuration**: https://docs.gitea.io/en-us/config-cheat-sheet/
- **Gitea API**: https://docs.gitea.io/en-us/api-usage/
---
**Last Updated**: 2026-04-22
**Server**: zet.home.arpa (172.27.0.35:3000)