คู่มือแบบละเอียด - ปี 2025-2026
คู่มือการย้าย Git Repository จาก Bitbucket Cloud และ Bitbucket Server ไปยัง GitLab แบบ Comprehensive พร้อม Troubleshooting
การย้ายจาก Bitbucket ไป GitLab เป็นการตัดสินใจที่สำคัญสำหรับ_teams และองค์กรในปัจจุบัน โดยมีเหตุผลหลักดังนี้:
สร้างบัญชี GitLab ที่ gitlab.com หรือ GitLab Self-Managed
Bitbucket username/password หรือ App Password
พื้นฐาน Git commands (clone, push, pull)
ควรเวลาเวลา 1-2 ชั่วโมงต่อ repository ขนาดกลาง
มีอยู่ด้วยกัน 3 วิธีหลัก ขึ้นอยู่กับความต้องการและ resources ของคุณ:
| วิธีการ | ความง่าย | ข้อมูลที่ย้าย | เหมาะสำหรับ | เวลาที่ใช้ |
|---|---|---|---|---|
| GitLab UI Import | ง่ายมาก | Repository, Issues, PRs, Wiki, Labels | Bitbucket Cloud (ทีมเล็ก-กลาง) | 5-30 นาที |
| Bitbucket Server Import | ปานกลาง | Repository, PRs, LFS, Comments | Bitbucket Server (Self-Managed) | 1-8 ชั่วโมง |
| Git Mirror Clone | ปานกลาง-ยาก | Repository เท่านั้น (ทุกข้อมูล) | ทีมขนาดใหญ่, ต้องการความสมบูรณ์ | 10-60 นาที |
| Manual Push Mirror | ยาก | Repository เท่านั้น | Backup, Sync ระหว่างทั้งสอง | 10-60 นาที |
สำหรับ Bitbucket Cloud: ใช้ GitLab UI Import - ง่ายและปลอดภัยที่สุด
สำหรับ Bitbucket Server: ใช้ Bitbucket Server Import หรือ Git Mirror
สำหรับทีมขนาดใหญ่: วางแผน migration แบบ step-by-step, test กับ repository เล็กก่อน
GitLab มี Import Tool ที่รองรับ Bitbucket Cloud อย่างเป็นทางการ สามารถย้าย repository, issues, merge requests, wiki และ metadata อื่นๆ ได้ทั้งหมด
ก่อนเริ่ม import ต้องสร้าง Bitbucket App Password ที่มีสิทธิ์อ่าน repository ทั้งหมด:
| Item | State | Comment |
|---|---|---|
| Repository | ✓ Imported | ทุก branch, tag, commit history |
| Issues | ✓ Imported | พร้อม comments และ assignees |
| Merge Requests | ✓ Imported | พร้อม comments และ reviewers |
| Wiki | ✓ Imported | All pages |
| Labels | ✓ Imported | Label colors preserved |
| Milestones | ✓ Imported | With due dates |
| LFS Objects | ✓ Imported | Large file storage |
| PR Approvals | ✗ Not imported | GitLab approval rules เป็นอีกระบบ |
| PR Rules | ✗ Not imported | ต้องตั้งใหม่ใน GitLab |
GitLab จะพยายามแมป Bitbucket(username) กับ GitLab ข้อมูลดังนี้:
สำหรับ user mapping ที่แม่นยำ ควร login ด้วยบัญชีที่ตรงกันก่อน import
สำหรับทีมที่ใช้ Bitbucket Server (เดิมเรียก Stash) และ GitLab Self-Managed การ import ต้องใช้ Bitbucket Server credentials ที่มี admin access
GitLab ต้องเข้าถึง Bitbucket Server ได้ (public หรือ internal network)
Bitbucket Server admin personal access token
Maintainer role บน destination group
| Item | Imported | Notes |
|---|---|---|
| Repository | ✓ Yes | Full commit history |
| PRs + Comments | ✓ Yes | รวม reviewers และ comments |
| LFS Objects | ✓ Yes | Large file storage |
| Comments on code | ✓ Yes | Out-of-bounds ถูก insert เป็น MR comment |
| Project filters | Partial | ไม่ support fuzzy search |
| Attachments in MD | ✗ No | ต้องย้าย manually |
| Task lists | ✗ No | ไม่ import |
เวลาในการ import ขึ้นกับขนาดของ repository:
| Size | PRs | Tags | Estimated Time |
|---|---|---|---|
| Small | <100 | <10 | 10-30 min |
| Medium | 100-1,000 | 10-100 | 30-60 min |
| Large | 1,000-10,000 | 100-1,000 | 1-4 ชม. |
| XLarge | >10,000 | >1,000 | 4-8 ชม.+ |
ตัวอย่าง: project ขนาด 500GiB, 13,000 PRs, 7,000 tags ≈ 8 ชั่วโมง
วิธีนี้เหมาะสำหรับทีมที่ต้องการควบคุมทุกอย่างด้วยตนเอง หรือต้องการ mirror ระหว่าง Bitbucket และ GitLab พร้อมกัน
ตั้งค่าให้ GitLab ดึงข้อมูลจาก Bitbucket อัตโนมัติ:
สาเหตุ: App password ไม่มีสิทธิ์หรือหมดอายุ
สาเหตุ: ตัว Bitbucket server หรือ reverse proxy ตั้งค่าไม่ถูกต้อง
สาเหตุ: Bitbucket username ไม่ตรงกับ GitLab username
สาเหตุ: Special characters ใน password/token