Initial commit

This commit is contained in:
Michael-A-Sloan committed 2026-08-02 16:12:17 -04:00
commit 3a1960d860
51 files changed
+3395

No files matched your search

+184
View File
@@ -0,0 +1,184 @@
# Gitea SSH on Unraid (reusable)
Use this for **any** repo on your Gitea (`git.masengr.com`) from the Unraid host — photo site, qBittorrent configs, etc.
## Why this setup
| Problem | Cause | Fix |
|--------|--------|-----|
| HTTPS keeps asking for a password | 2FA → need a PAT, not account password | Prefer SSH |
| `ssh git.masengr.com` asks for password on port 22 | Port **22** is Unraid’s SSH, not Gitea | Use Gitea’s mapped port |
| `git.masengr.com:2222` → connection refused | Public DNS/SWAG doesn’t expose 2222 | From Unraid, use `127.0.0.1` + Gitea SSH port |
Your Gitea container typically publishes SSH like:
```text
0.0.0.0:2222->22/tcp
```
Confirm anytime:
```bash
docker ps --format 'table {{.Names}}\t{{.Ports}}' | grep -i gitea
```
Use whatever **host** port maps to container `22` (often `2222`).
---
## One-time: create a user SSH key (all your repos)
On Unraid:
```bash
ssh-keygen -t ed25519 -C "unraid-gitea" -f ~/.ssh/gitea_unraid -N ""
cat ~/.ssh/gitea_unraid.pub
```
In Gitea (web UI):
1. Avatar → **Settings → SSH / GPG Keys → Add Key**
2. Title: `unraid-gitea`
3. Paste the **entire** `.pub` line (`ssh-ed25519 AAAA... unraid-gitea`)
4. Save
Use a **user** SSH key (works for every repo your user can access).
Use a **Deploy Key** only when you want one repo, read-only.
---
## One-time: SSH config on Unraid
Point the hostname at **local** Gitea SSH (same machine):
```bash
mkdir -p ~/.ssh
cat > ~/.ssh/config <<'EOF'
Host git.masengr.com
HostName 127.0.0.1
User git
Port 2222
IdentityFile ~/.ssh/gitea_unraid
IdentitiesOnly yes
EOF
chmod 700 ~/.ssh
chmod 600 ~/.ssh/config ~/.ssh/gitea_unraid
chmod 644 ~/.ssh/gitea_unraid.pub
```
If `docker ps` shows a different host port than `2222`, change `Port` to match.
### Test (success looks like this)
```bash
ssh -T git@git.masengr.com
```
Expected:
```text
Hi there, YOUR_USERNAME! You've successfully authenticated with the key named gitea_unraid, but Gitea does not provide shell access.
```
- **No password prompt** = good
- Post-quantum / `known_hosts` warnings can be ignored if auth succeeds
- If you see `Connection refused` on `git.masengr.com:2222` without this config, you were hitting the public IP — keep `HostName 127.0.0.1`
---
## Per repo: use an SSH remote
```bash
cd /path/to/clone
git remote set-url origin git@git.masengr.com:YOUR_NAMESPACE/YOUR_REPO.git
git remote -v
git pull
```
Examples:
```bash
git@git.masengr.com:Michael-A-Sloan/Neon-Photos_Site.git
git@git.masengr.com:Michael-A-Sloan/qBittorrent-Enhanced-Edition-docker-with-vpn.git
```
Clone fresh with SSH:
```bash
cd /mnt/user/appdata
git clone git@git.masengr.com:Michael-A-Sloan/SOME_REPO.git some-folder
```
---
## Day-to-day
```bash
cd /path/to/repo
git pull
# then whatever that project uses, e.g.:
# sh scripts/deploy.sh
```
No PAT prompt for git over SSH.
---
## Troubleshooting
### Still asks for password
```bash
ssh -vT git@git.masengr.com 2>&1 | grep -iE 'Offering public key|Authentications that can continue|Authenticated|Connection'
```
Check:
1. Pubkey is on **user** SSH keys in Gitea (exact match to `cat ~/.ssh/gitea_unraid.pub`)
2. `Port` matches `docker ps` host mapping
3. `HostName` is `127.0.0.1` (or `192.168.10.3`) when running **on** Unraid
4. Remote is SSH, not HTTPS: `git remote -v` should show `git@git.masengr.com:...`
### Connection refused
- Wrong port, or `HostName` is the public DNS without 2222 forwarded
- On Unraid → use `127.0.0.1` + correct `Port`
### Remake the key
```bash
rm -f ~/.ssh/gitea_unraid ~/.ssh/gitea_unraid.pub
# Delete old key in Gitea UI, then redo "create key" + paste .pub steps above
```
### HTTPS PAT (only if you must avoid SSH)
```bash
git config --global credential.helper store
# git pull once; username = Gitea user; password = PAT (not account password)
chmod 600 /root/.git-credentials
```
SSH is preferred on Unraid for this Gitea.
---
## What not to do
- Don’t put a Gitea PAT in app `.env` or Docker template variables
- Don’t use Unraid host port **22** for Gitea if Unraid already owns SSH there
- Don’t expect `git.masengr.com:2222` from the internet unless you intentionally port-forward it
---
## Quick checklist (new machine / new Unraid flash)
1. [ ] `ssh-keygen` → `~/.ssh/gitea_unraid`
2. [ ] Paste `.pub` into Gitea user SSH keys
3. [ ] `~/.ssh/config` with `HostName 127.0.0.1`, `Port 2222` (or your map)
4. [ ] `ssh -T git@git.masengr.com` greets you
5. [ ] `git remote set-url origin git@git.masengr.com:USER/REPO.git`
6. [ ] `git pull` with no password