2.5 KiB
2.5 KiB
push ขึ้น Gitea
repo นี้ผูก remote ใหม่ไว้แล้วและ push ได้แบบไม่ต้องล็อกอินซ้ำ ในเครื่องนี้ (credential เก็บผ่าน Git Credential Manager)
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แล้ว
คำสั่งที่ใช้จริง
cd D:/Git/workspace/web-alterflixhub
git push origin main
ลำดับก่อน push (ทำทุกครั้ง)
pnpm typecheck # ต้องผ่าน
npx vitest --run app/lib # unit tests
git add -A
git commit -m "..." # ข้อความสั้น บอกสิ่งที่เปลี่ยน
git push origin main
ถ้าแก้ public/sw.js ต้อง bump VERSION ในไฟล์นั้นก่อน commit (ขั้น activate จะกวาดแคชเก่าให้เอง)
ถ้า credential หมดอายุ / ขึ้น 401
ห้ามฝัง token หรือรหัสผ่านใน URL ของ remote และห้าม commit ลงไฟล์ — ใช้วิธีใดวิธีหนึ่ง:
- ล้าง credential เก่าให้ Git Credential Manager ถามใหม่ (หน้าต่างล็อกอินจะเด้ง):
printf 'protocol=https\nhost=git.hobbypj.com\n\n' | git credential reject git push origin main - ให้ Git Credential Manager เก็บ credential ให้ครั้งเดียวจาก terminal ปกติของ Windows (ไม่ผ่าน agent) แล้ว
git push - สร้าง token ใหม่ที่ Gitea → Settings → Applications → Generate New Token (สิทธิ์
write:repository) — เก็บใน credential manager เท่านั้น
ตรวจว่าขึ้นจริง
git log --oneline -1 origin/main # ต้องเห็น commit ล่าสุด
git status -sb # ต้องไม่มี ahead
git ls-remote origin main # hash ต้องตรงกับ HEAD