6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

旧GitLabから新GitLab(Gitlab12)への移行

Last updated at Posted at 2019-06-17

概要

  • 会社の標準とされているGitサーバのGitLabが古すぎてかなわん
  • サービス間連携とか一切できないので新しいGitLabを立てて移行してしまう
  • 本当はGitHub使いたい。。エンジニア以外も使うとなるとコストバカにならない。
  • でも意外と機能豊富でGitHubより実はいいんじゃね?と思っている
  • CodeCommitも使っていたが、最近はAWSに依存しないようにしてるので

旧GitLabからコミットログなど含めてCloneしてくる

$ git clone --mirror http://gitlab.hoge.net/hoge/repohoge.git
Cloning into bare repository 'repohoge.git'...
remote: Counting objects: 72486, done.
remote: Compressing objects: 100% (26432/26432), done.
remote: Total 72486 (delta 50605), reused 64973 (delta 44691)
Receiving objects: 100% (72486/72486), 663.35 MiB | 39.67 MiB/s, done.
Resolving deltas: 100% (50605/50605), done.

$ cd repohoge

新GitLabへPUSHする

$ git push --mirror "https://gitlab.hogehoge.net/hoge/repohoge.git"
Username for 'https://gitlab.hogehoge.net': username
Password for 'https://username@gitlab.hogehoge.net': password
Counting objects: 68255, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (19677/19677), done.
Writing objects: 100% (68255/68255), 647.17 MiB | 28.85 MiB/s, done.
Total 68255 (delta 47251), reused 68255 (delta 47251)
remote: Resolving deltas: 100% (47251/47251), done.
remote:
:
:
 * [new tag]         aaaaa -> aaaaa
 * [new tag]         bbbbb -> bbbbb

超簡単!

遭遇したエラー

"error: failed to push some refs ..."

  • リモートとローカルのブランチに差異がある場合

 ! [remote rejected] master -> master (pre-receive hook declined)
 ! [remote rejected] develop -> develop (pre-receive hook declined)
:
:
 ! [remote rejected] aaaaa -> aaaaa (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.hogehoge.net/hoge/hoge.git'

新GitLab側でリポジトリを削除

  • Gitlab上で対象のリポジトリに遷移する
  • 設定→一般→展開→プロジェクトを削除で対象のリポジトリを削除

image.png

image.png

image.png

image.png

ローカル側で新たにPUSH

$ git push --mirror "https://gitlab.hogehoge.net/hoge/repohoge.git"

※ 上記はローカルリポジトリが正である場合に限る

6
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?