46 lines
2.8 KiB
Markdown
46 lines
2.8 KiB
Markdown
# push ขึ้น Gitea
|
|
|
|
repo นี้ commit ไว้ในเครื่องแล้ว แต่ **ยังไม่ขึ้น Gitea** เพราะเครื่องนี้รัน git แบบไม่มี GUI
|
|
ทำให้ Git Credential Manager เรียกขอรหัสไม่ได้ (push จะค้าง) — ต้องให้สิทธิ์ก่อนหนึ่งครั้ง
|
|
|
|
Gitea: `http://103.107.52.82:3004` · org: `alterflixhub` · repo ที่มีอยู่: `web-alterflixhub`
|
|
|
|
## วิธีที่ 1 — ล็อกอินผ่าน Git Credential Manager (ง่ายสุด)
|
|
|
|
เปิด terminal ปกติของ Windows (ไม่ใช่ผ่าน agent) แล้วรัน:
|
|
|
|
```bash
|
|
cd D:/Git/workspace/alterflixhub-reboot
|
|
git push -u origin main
|
|
```
|
|
|
|
หน้าต่างล็อกอินจะเด้ง → ใส่ user/รหัส Gitea หนึ่งครั้ง หลังจากนั้น push ได้ตลอด
|
|
|
|
## วิธีที่ 2 — ใช้ access token (ไม่ต้องมี GUI)
|
|
|
|
สร้าง token ที่ Gitea → Settings → Applications → Generate New Token (สิทธิ์ `write:repository`)
|
|
แล้วรัน (แทน `<TOKEN>` ด้วยค่าจริง — อย่าเก็บไว้ในไฟล์ที่ commit):
|
|
|
|
```bash
|
|
cd D:/Git/workspace/alterflixhub-reboot
|
|
git remote set-url origin "http://Bkk1234:<TOKEN>@103.107.52.82:3004/alterflixhub/alterflixhub-reboot.git"
|
|
git -c http.version=HTTP/1.1 push -u origin main
|
|
```
|
|
|
|
## เลือกปลายทาง
|
|
|
|
| ต้องการ | สิ่งที่ต้องทำ |
|
|
|---|---|
|
|
| repo ใหม่ `alterflixhub/alterflixhub-reboot` | สร้าง repo บน Gitea (private) แล้วตั้ง remote ตามด้านบน |
|
|
| branch ใหม่ใน repo เดิม | `git remote set-url origin "http://[email protected]:3004/alterflixhub/web-alterflixhub.git"` แล้ว `git -c http.version=HTTP/1.1 push -u origin main:reboot` |
|
|
| แทนที่ main ของ repo เดิม | เหมือนข้อบน แต่ push `main:main` (ทับของเดิม — ระวัง) |
|
|
|
|
## หมายเหตุ
|
|
|
|
- `data/` ถูก `.gitignore` ไว้ → **ข้อมูลโรงหนัง/คำศัพท์ไม่อยู่ใน git** (โคลนใหม่จะได้ seed จาก `app/lib/cinemas.ts`)
|
|
- `.env` ก็ไม่ถูก commit · ต้องสร้างจาก `.env.example` บนเครื่องใหม่
|
|
- ถ้าต้องการให้ content.json อยู่ใน git ด้วย ให้เพิ่มข้อยกเว้นใน `.gitignore`:
|
|
```
|
|
!data/content/content.json
|
|
```
|