docs: เปลี่ยน remote Gitea เป็น git.hobbypj.com + ลบตัวอย่าง token ในเอกสาร

This commit is contained in:
Bkk1234 committed 2026-11-21 15:26:18 +07:00
1 parent 1c38d8e286
commit 507cd44d49
1 file changed
+16 -15
+16 -15
View File
@@ -1,43 +1,44 @@
# push ขึ้น Gitea
repo นี้ผูก remote ไว้แล้วและ **push ได้แบบไม่ต้องล็อกอินซ้ำ** ในเครื่องนี้ (credential ถูกเก็บไว้แล้ว)
repo นี้ผูก remote ใหม่ไว้แล้วและ **push ได้แบบไม่ต้องล็อกอินซ้ำ** ในเครื่องนี้ (credential เก็บผ่าน Git Credential Manager)
```
remote : http://103.107.52.82:3004/alterflixhub/web-alterflixhub.git
remote : https://git.hobbypj.com/alterflixhub/web-alterflixhub.git
branch : main
```
> ย้ายมาจาก `http://103.107.52.82:3004/...` (host เก่าเลิกใช้) — host ใหม่รองรับ HTTP/2 ปกติ **ไม่ต้องใส่ `-c http.version=HTTP/1.1` แล้ว**
## คำสั่งที่ใช้จริง
```bash
cd D:/Git/workspace/web-alterflixhub
git -c http.version=HTTP/1.1 push origin main
git push origin main
```
**ต้องใส่ `-c http.version=HTTP/1.1` เสมอ** — Gitea ตัวนี้ปิด HTTP/2 ไว้ ทำให้ push แบบ HTTP/2 ค้าง/หลุดกลางทาง
## ลำดับก่อน push (ทำทุกครั้ง)
```bash
pnpm typecheck # ต้องผ่าน
npx vitest --run app/lib # unit tests (16 ไฟล์ / 135+ ตัว)
npx vitest --run app/lib # unit tests
git add -A
git commit -m "..." # ข้อความสั้น บอกสิ่งที่เปลี่ยน
git -c http.version=HTTP/1.1 push origin main
git push origin main
```
ถ้าแก้ `public/sw.js` ต้อง bump `VERSION` ในไฟล์นั้นก่อน commit (ขั้น activate จะเก็บกวาดแคชเก่าให้เอง)
ถ้าแก้ `public/sw.js` ต้อง bump `VERSION` ในไฟล์นั้นก่อน commit (ขั้น activate จะกวาดแคชเก่าให้เอง)
## ถ้า credential หมดอายุ / ขึ้น 401
สร้าง token ที่ Gitea → Settings → Applications → Generate New Token (สิทธิ์ `write:repository`)
แล้วตั้ง remote ใหม่ (แทน `<TOKEN>` ด้วยค่าจริง — **ห้ามเก็บลงไฟล์ที่ commit**):
**ห้ามฝัง token หรือรหัสผ่านใน URL ของ remote และห้าม commit ลงไฟล์** — ใช้วิธีใดวิธีหนึ่ง:
```bash
git remote set-url origin "http://Bkk1234:<TOKEN>@103.107.52.82:3004/alterflixhub/web-alterflixhub.git"
```
หรือล็อกอินผ่าน Git Credential Manager จาก terminal ปกติของ Windows (ไม่ผ่าน agent) แล้ว `git push` หนึ่งครั้ง
1. ล้าง credential เก่าให้ Git Credential Manager ถามใหม่ (หน้าต่างล็อกอินจะเด้ง):
```bash
printf 'protocol=https\nhost=git.hobbypj.com\n\n' | git credential reject
git push origin main
```
2. ให้ Git Credential Manager เก็บ credential ให้ครั้งเดียวจาก terminal ปกติของ Windows (ไม่ผ่าน agent) แล้ว `git push`
3. สร้าง token ใหม่ที่ Gitea → Settings → Applications → Generate New Token (สิทธิ์ `write:repository`) — เก็บใน credential manager เท่านั้น
## ตรวจว่าขึ้นจริง