刺身タンポポ職人なう

文系女子大生がエンジニアとして就職してその後

vagrant × gitLab

gitLabのダウンロード

Download GitLab Community Edition (CE) | GitLab

↑でCentOS6を選択して出てきたコマンドそのまま

前の記事でansibleを触ってみたにも関わらず、直接コマンドをうつ。ごめんなさい。

$ vagrant ssh
[vagrant@localhost ~]$ sudo yum install curl openssh-server postfix cronie
[vagrant@localhost ~]$ sudo service postfix start
[vagrant@localhost ~]$ sudo chkconfig postfix on
[vagrant@localhost ~]$ sudo lokkit -s http -s ssh
[vagrant@localhost ~]$ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
[vagrant@localhost ~]$ sudo yum install gitlab-ce
[vagrant@localhost ~]$ sudo gitlab-ctl reconfigure

コマンド通りで、gitLabのインストール完了

Vagrantファイルのコメントアウトを削除

config.vm.network :private_network, ip: "192.168.33.10"
config.vm.network :forwarded_port, host: 80, guest: 8888

そのあとgitLab入ったはいいものの、cloneとかできず??

$ git clone git@localhost:8888/user_name/test-projec.git
Cloning into 'test-project'...
ssh: connect to host localhost port 22: Connection refused
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

ぜんぜんわかんない〜

$ ssh localhost:8888
ssh: connect to host localhost port 22: Connection refused

Connection refusedでぐぐっても情報がありすぎて精査できない情弱さ。

助けを求めました。

☁ ssh 192.168.33.10
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
91:32:b2:04:66:f3:bd:50:13:af:b2:6c:42:9e:92:36.
## Url on which GitLab will be reachable.
Please contact your system administrator.
Add correct host key in /Users/tooooomin/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/tooooomin/.ssh/known_hosts:6
RSA host key for 192.168.33.10 has changed and you have requested strict checking.
Host key verification failed.

-> /Users/tooooomin/.ssh/known_hosts ファイルのなかの 192.168.33.10 のkeyを削除

おおおおっ!

☁ ssh vagrant@192.168.33.10
vagrant@192.168.33.10's password:
Last login: Thu May 21 11:39:51 2015 from 10.0.2.2
Welcome to your Vagrant-built virtual machine.
[vagrant@localhost ~]$

おおおおおおおおおおお(/・ω・)/

vagrantのgitLabに繋げられたので、既存リポジトリをpushしてみる。

参考 タイトルとか決めてないけどこのままでもいいかもしんない: 外部のbareリポジトリとオレオレGitlabを連携させてみる

[vagrant@localhost ~]$ sudo vi /etc/gitlab/gitlab.rb
external_url "http://localhost"
// ↑この行を
external_url “192.168.33.10"
// ↑に変更しておくとらくちんかも
[vagrant@localhost ~]$ sudo gitlab-ctl reconfigure

ミラーリポジトリでクローンしてきて、プッシュしなおした (既存リポジトリの移行方法がこれでいいのかはまだわからん)

$ git clone --mirror git@既存リポジトリ.git
$ git config remote.origin.url
git@既存リポジトリ.git
$ git remote  set-url origin git@192.168.33.10:user_name/test-project.git
$ git config remote.origin.url
git@192.168.33.10: user_name/test-project.git
$ git push origin --mirror

入っていらっしゃる!

[root@localhost vagrant]# cd /var/opt/gitlab/git-data/repositories/user_name/
test-project.git/         test-project.wiki.git/

動いていらっしゃる!!! とりあえず満足。

めも

最近本読んでないから読まなきゃな〜。☁☁☁☁はzshのテーマ。