From 507cd44d49d9aa2d3871ad57e8d6582644a7b3dd Mon Sep 17 00:00:00 2001 From: Bkk1234 Date: Sat, 21 Nov 2026 15:26:18 +0700 Subject: [PATCH] =?UTF-8?q?docs:=20=E0=B9=80=E0=B8=9B=E0=B8=A5=E0=B8=B5?= =?UTF-8?q?=E0=B9=88=E0=B8=A2=E0=B8=99=20remote=20Gitea=20=E0=B9=80?= =?UTF-8?q?=E0=B8=9B=E0=B9=87=E0=B8=99=20git.hobbypj.com=20+=20=E0=B8=A5?= =?UTF-8?q?=E0=B8=9A=E0=B8=95=E0=B8=B1=E0=B8=A7=E0=B8=AD=E0=B8=A2=E0=B9=88?= =?UTF-8?q?=E0=B8=B2=E0=B8=87=20token=20=E0=B9=83=E0=B8=99=E0=B9=80?= =?UTF-8?q?=E0=B8=AD=E0=B8=81=E0=B8=AA=E0=B8=B2=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/push-to-gitea.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/push-to-gitea.md b/docs/push-to-gitea.md index f231bb5..e40f2dc 100644 --- a/docs/push-to-gitea.md +++ b/docs/push-to-gitea.md @@ -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 ใหม่ (แทน `` ด้วยค่าจริง — **ห้ามเก็บลงไฟล์ที่ commit**): +**ห้ามฝัง token หรือรหัสผ่านใน URL ของ remote และห้าม commit ลงไฟล์** — ใช้วิธีใดวิธีหนึ่ง: -```bash -git remote set-url origin "http://Bkk1234:@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 เท่านั้น ## ตรวจว่าขึ้นจริง