CentOS6.4にGitLab5.0をインストールしてハマった
CentOS6.4にGitLab5.0をインストールしたのですが、主に2つのことでハマりましたのでメモしておきます。
GitLab5.0 + unicorn + nginxという、最近よくある構成です。
URLは http://host/gitlab/ という形で、サブディレクトリでつなぐ様にしました。
まず、インストールの時に参考にしたサイトは、公式のinstallation.md。あとは適当にアレンジしました。
とりあえずインストールを終えて、プロジェクトを作成し、SSHキーを追加しました。
そして、remote repositoryへのpush/pullをしようとした時に問題が発覚というわけです。
SSH経由でgitユーザーのパスワードを聞かれる
登録していた公開鍵にはパスワードを付けていませんでした。
それなのにパスワードを聞かれるので、あれ?と思いました。
comolog: CentOS 6.4 に GitLab 5.0.0 をインストールしてはまったことを参考に以下で解決。
chmod 700 /home/git/.ssh chmod 600 /home/git/.ssh/authorized_keys
今度はCould no read from remote repositoryと言われる
git push -u origin masterをすると、
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
と言われてしまいました。
ググっていたら、
https://github.com/gitlabhq/gitlabhq/issues/3384
が見つかったのですが、よくわからず、とりあえず単純にsshで接続したところ、
PTY allocation request failed on channel 0 /usr/lib64/ruby/1.9.1/json/common.rb:148:in `parse': 746: unexpected token at 'Not Found: /api/v3/internal/discover' (JSON::ParserError) from /usr/lib64/ruby/1.9.1/json/common.rb:148:in `parse' from /home/git/gitlab-shell/lib/gitlab_net.rb:24:in `discover' from /home/git/gitlab-shell/lib/gitlab_shell.rb:28:in `exec' from /home/git/gitlab-shell/bin/gitlab-shell:16:in `' Connection to 192.168.xxx.xxx closed.
と返って来ましたので、gitlab-shell絡みだろうとあたりをつけて、設定を見返すことに。
いろいろ悩んだのですが、結果から言えばgitlab-shell/config.ymlの次のところでした。
gitlab_url: "http://127.0.0.1:8080/gitlab/"
8080というポートはunicorn.rbで私が勝手に指定しているポートです。
考えてみれば当然で、サブディレクトリで動かしているのだから、そこを指定してやらなきゃいけないわけです。
ハマっているときはこうでした。
gitlab_url: "http://127.0.0.1:8080/"