« 06.03 伊香保で浸かってうどんを食す | ココ | 06.06 宇宙兄弟 »

2012年6月 5日

DotCloudをGit serverにしてみる(3)  このエントリーを含むはてなブックマーク 

そういえば、gitでWebDAVが使えるんやったらsshでコミットしなくてもhttpでコミットできるんやんな…と思った。git clone で作ったローカルのレポジトリディレクトリに移動して、ファイルを作ってコミットをするところを確認。

$ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
$ echo "This is the test file." > test.txt
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# test.txt
nothing added to commit but untracked files present (use "git add" to track)

うむ。ちゃんと変更されているファイルを認識している。ではコミットしてみるか。

$ git commit -m 'test.txt commit'
[master (root-commit) 2907ce7] test.txt commit
 Committer: pinmarch <pinmarch@localhost.localdomain>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

     git commit --amend --author='Your Name <you@example.com>'

 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 test.txt

コミットはOK。ここまではローカルの話やからできて普通と思う。


で、それを今度はDotCloud上に作ってあるリモートレポジトリに上げる。設定を確認して、push。

$ git config --list
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=http://testgit-67yk2h4g.dotcloud.com/test.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
$ git push origin master
error: Cannot access URL http://testgit-67yk2h4g.dotcloud.com/test.git/, return code 22
fatal: git-http-push failed

あれ…エラーでpushできない…。

$ dotcloud logs testgit.nginx
# tail -F /var/log/supervisor/*.log
==> /var/log/supervisor/nginx_access.log <==
192.168.0.1 (-) - - [01/Jun/2012:15:47:13 +0000] "-" 400 0 "-" "-"
0.115.5.72 (::ffff:22.6.15.44) - - [01/Jun/2012:15:47:33 +0000] "GET /test.git/info/refs?service=git-upload-pack HTTP/1.1" 200 0 "-" "git/1.7.3.4"
0.115.5.72 (::ffff:22.6.15.44) - - [01/Jun/2012:15:47:34 +0000] "GET /test.git/HEAD HTTP/1.1" 200 23 "-" "git/1.7.3.4"
0.79.7.178 (::ffff:22.6.15.44) - - [09/Jun/2012:03:51:28 +0000] "GET /test.git/info/refs?service=git-receive-pack HTTP/1.1" 200 0 "-" "git/1.7.3.4"
0.79.7.178 (::ffff:22.6.15.44) - - [09/Jun/2012:03:51:28 +0000] "GET /test.git/HEAD HTTP/1.1" 200 23 "-" "git/1.7.3.4"
0.115.5.72 (::ffff:22.6.15.44) - - [09/Jun/2012:03:53:35 +0000] "GET /test.git/info/refs?service=git-receive-pack HTTP/1.1" 200 0 "-" "git/1.7.3.4"
0.115.5.72 (::ffff:22.6.15.44) - - [09/Jun/2012:03:53:36 +0000] "GET /test.git/HEAD HTTP/1.1" 200 23 "-" "git/1.7.3.4"
0.127.7.84 (::ffff:22.6.15.44) - - [09/Jun/2012:04:14:13 +0000] "GET /test.git/info/refs?service=git-receive-pack HTTP/1.1" 200 0 "-" "git/1.7.3.4"
0.127.7.84 (::ffff:22.6.15.44) - - [09/Jun/2012:04:14:13 +0000] "GET /test.git/HEAD HTTP/1.1" 200 23 "-" "git/1.7.3.4"
0.79.7.178 (::ffff:22.6.15.44) - - [09/Jun/2012:04:14:14 +0000] "PROPFIND /test.git/ HTTP/1.1" 405 173 "-" "git/1.7.3.4"

PROPFINDで405が返ってくる。どういうことやろうか。DAVの設定(受け付けるメソッドのlocation)がおかしいのかと思ってちょっといじってみたりもしたけど、結果は変わらず。

gitのリモートレポジトリへのpushで動作がおかしい(405が出たりcode 22が返ってきてたり)という記事は検索してたらたいていGitHubの内容やったりするから結局SSHの設定に変えたらええやん、ということで終わってることが多くてどうにも目的の記事にありつけない。とりあえずOPTIONSのリクエストを投げてみるといいらしいってことでやってみたけど…。

$ telnet testgit-67yk2h4g.dotcloud.com 80
Trying 0.9.12.15...
Connected to testgit-67yk2h4g.dotcloud.com.
Escape character is '^]'.
OPTIONS /test.git/ HTTP/1.1
Host: testgit-67yk2h4g.dotcloud.com
Content-Length: 0

HTTP/1.1 405 Method Not Allowed
server: nginx/1.0.14
date: Sat, 09 Jun 2012 12:24:58 GMT
content-type: text/html
content-length: 173
connection: close

<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx/1.0.14</center>
</body>
</html>
Connection closed by foreign host.

Not Allowed…?? どういうことや。設定をよくよく見直してみると、抜けているところがあった。create_full_put_path on; というのと、dav_access group:rw all:rw;というのがいるらしい。ということでnginx/nginx.conf.inを書き換えて、それからsshでDotCloudに入ってtest.gitディレクトリを含むの配下のファイルをchmod 777で権限変更。

それからもう1回pushしてみる…。

$ git push origin master
error: no DAV locking support on http://testgit-67yk2h4g.dotcloud.com/test.git/
fatal: git-http-push failed

あれぇ。

By ただ at 22:53 カテゴリー ; プログラミングとか

« 06.03 伊香保で浸かってうどんを食す | 06月の記事 | 06.06 宇宙兄弟 »




トラックバック

このエントリーのトラックバックURL:
http://pinmarch.sakura.ne.jp/mt/mt-tb.cgi/1807