📝 Python

Миграция с GitLab на GitHub 🚚

0
Author
04e5cc8b-58ac-4bdc-bdee-661bbb
📅
Published
06.05.2026
⏱️
Reading time
4 min
👁️
Views
18
🌱
Level
Beginner

Переезжаете с GitLab на GitHub? Полное руководство по миграции проектов!

Зачем мигрировать?

GitLab отличен for:
- Встроенный мощный CI/CD
- Self-hosted решения
- DevOps инструменты

GitHub лучше для:
- Портфолио (больше видимость)
- Open Source сообщество
- GitHub Actions
- Интеграции

Способ 1: Импорт через GitHub (САМЫЙ ПРОСТОЙ)

Шаги:

  1. Идите на github.com/new/import
  2. Вставьте GitLab URL:
    https://gitlab.com/username/project
  3. Если приватный → введите GitLab Personal Access Token:
    - GitLab → Settings → Access Tokens
    - Создайте token со scope read_repository
  4. Выберите имя репозитория на GitHub
  5. Public/Private
  6. Begin import

✅ GitHub автоматически перенесёт всё!

Способ 2: Git mirror (полный контроль)

Команды:

# 1. Клонируйте с GitLab (bare mode)
git clone --bare https://gitlab.com/username/project.git

# 2. Перейдите в папку
cd project.git

# 3. Создайте репозиторий на GitHub.com

# 4. Push зеркало
git push --mirror https://github.com/username/project.git

# 5. Cleanup
cd ..
rm -rf project.git

Всё! Код с полной историей на GitHub!

Способ 3: Через GitHub Desktop

  1. Clone GitLab репозиторий:
    - File → Clone Repository → URL
    - Вставьте GitLab HTTPS URL
  2. После клонирования: Publish repository
  3. Готово!

Что переносится автоматически?

✅ Переносится

  • Весь код
  • История коммитов
  • Все ветки
  • Теги
  • Contributors (авторы)

❌ НЕ переносится

  • Issues
  • Merge Requests (→ Pull Requests)
  • CI/CD Pipelines
  • Wiki
  • Milestones
  • Labels

Пост-миграция: адаптация

1. GitLab CI → GitHub Actions

Было (.gitlab-ci.yml):

test:
  script:
    - npm install
    - npm test

Стало (.github/workflows/ci.yml):

name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm install
      - run: npm test

2. Миграция Issues (если нужно)

Используйте инструмент: github.com/piceaTech/node-gitlab-2-github

npm install -g github-cli gitlab-2-github

g2g migrate \
  --gitlabUrl https://gitlab.com \
  --gitlabToken YOUR_GITLAB_TOKEN \
  --githubToken YOUR_GITHUB_TOKEN \
  --gitlabProjectId 12345 \
  --githubOwner username \
  --githubRepo project

3. Обновите README бейджи

Было (GitLab):

[![pipeline status](https://gitlab.com/username/project/badges/main/pipeline.svg)]

Стало (GitHub):

![CI](https://github.com/username/project/actions/workflows/ci.yml/badge.svg)
![Stars](https://img.shields.io/github/stars/username/project)

Multiple проектов: массовая миграция

Скрипт для переноса нескольких проектов:

#!/bin/bash

GITLAB_URL="https://gitlab.com"
GITHUB_URL="https://github.com"

# Ваши репозитории
declare -a repos=(
  "project1"
  "project2"
  "project3"
)

for repo in "${repos[@]}"; do
  echo "Migrating $repo..."

  git clone --bare $GITLAB_URL/username/$repo.git
  cd $repo.git
  git push --mirror $GITHUB_URL/username/$repo.git
  cd ..
  rm -rf $repo.git

  echo "✅ $repo done!"
done

Командная миграция

Уведите команду:

## 📣 Мы переезжаем на GitHub!

**Старый (GitLab):**
https://gitlab.com/team/project

**Новый (GitHub):**
https://github.com/team/project

**Инструкции для команды:**

### Если уже есть клон:

\`\`\`bash
cd project
git remote set-url origin https://github.com/team/project.git
git fetch
\`\`\`

### Новички:

\`\`\`bash
git clone https://github.com/team/project.git
\`\`\`

**Дедлайн:** 15 апреля 2026
После этого GitLab repo будет read-only.

Сохранение истории GitLab

Если хотите сохранить Issues/MRs:

1. Экспорт проекта GitLab

  1. GitLab → Settings → General
  2. Advanced → Export project
  3. Скачайте архив (.tar.gz)

Храните как backup!

2. Сделайте GitLab read-only

  1. Settings → General → Permissions
  2. Project visibility → Private
  3. ✅ Disable forking
  4. ✅ Disable merge requests
  5. README — добавьте баннер:
## ⚠️ This project moved to GitHub

**New location:**
https://github.com/username/project

Сравнение CI/CD

Feature GitLab CI GitHub Actions
Конфиг файл .gitlab-ci.yml .github/workflows/*.yml
Runners Shared/Own GitHub hosted/Self-hosted
Минут (Free) 400/month 2000/month
Артефакты 1GB 500MB
Docker support ✅ Отлично ✅ Отлично
Сложность Проще Чуть сложнее

Частые проблемы

Protected branches

GitLab → Settings → Repository → Protected Branches

Перенести в:

GitHub → Settings → Branches → Branch protection rules

LFS (Large File Storage)

Если используете Git LFS:

# Клонировать с LFS
git lfs clone --bare https://gitlab.com/user/repo.git

# Push с LFS
cd repo.git
git lfs push --all https://github.com/user/repo.git

Different authentication

GitLab может использовать Deploy Keys, GitHub — Deploy Keys или Personal Access Tokens.

Обновите в:
- CI/CD secrets
- Deployment scripts
- Webhooks

Почему GitHub?

Для разработчиков:

  • ✅ Портфолио виднее
  • ✅ Больше job opportunities
  • ✅ Проще для начинающих
  • ✅ GitHub Copilot
  • ✅ Codespaces (cloud IDE)

Для компаний:

  • ✅ GitHub Advanced Security
  • ✅ Dependabot (автоматические security updates)
  • ✅ GitHub Sponsors (монетизация open source)

Почему GitLab лучше:

  • ✅ Мощнее CI/CD из коробки
  • ✅ Бесплатнее для больших команд
  • ✅ Self-hosted опция
  • ✅ Built-in container registry

Обратная миграция

Передумали? Можно вернуться:

git clone --bare https://github.com/user/repo.git
cd repo.git
git push --mirror https://gitlab.com/user/repo.git

Checklist миграции

  • [ ] Экспортировали Issues/MR (если нужно)
  • [ ] Создали репозиторий на GitHub
  • [ ] Перенесли код (git push --mirror)
  • [ ] Настроили GitHub Actions (заменили .gitlab-ci.yml)
  • [ ] Обновили README (badges, links)
  • [ ] Настроили branch protection
  • [ ] Обновитеили CI/CD secrets
  • [ ] Уведомили команду
  • [ ] Обновили documentation
  • [ ] Тестировали CI/CD pipelines
  • [ ] Сделали GitLab repo read-only

Удачной миграции! Добро пожаловать в GitHub! 🎉

Your reaction to the article

💬 Comments (0)

🔐 Sign in to leave a comment
🚪 Login
💭

No comments yet

Be the first to share your opinion about this article!

🔗 Similar

Similar articles

Continue learning with these materials

📝

Модуль datetime: работа с датами и временем

datetime — стандартный модуль Python для работы с датами и временем. Входит в стандартную библиотеку,...

📅 08.05.2026 👁️ 30
📝

.env файлы и переменные окружения: секреты вне ко…

Представь что ты написал программу с API-ключом прямо в коде и залил её на GitHub....

📅 08.05.2026 👁️ 35
📝

Виртуальные окружения в Python: зачем и как

Когда начинаешь второй Python-проект и ставишь pip install requests — эта библиотека устанавливается глобально, для...

📅 08.05.2026 👁️ 31

Did you like the article?

Subscribe to our updates and receive new articles first. Grow with PyLand!