Showing 2 changed files with 44 additions and 5 deletions
+13 -5
script/gitprep-shell
... ...
@@ -9,6 +9,8 @@ use lib "$FindBin::Bin/../lib";
9 9
 use lib "$FindBin::Bin/../extlib/lib/perl5";
10 10
 use Gitprep;
11 11
 
12
+my $debug = 0;
13
+
12 14
 # Project name pattern
13 15
 my $project_re = qr/[a-zA-Z0-9_\-\.]+$/;
14 16
 
... ...
@@ -27,13 +29,16 @@ my $dbi = $app->dbi;
27 29
 
28 30
 # SSH connection
29 31
 my $ssh_connection = $ENV{SSH_CONNECTION};
32
+warn "ssh_connection: $ssh_connection" if $debug;
30 33
 die "who the *heck* are you?" unless defined $ssh_connection;
31 34
 
32 35
 # SSH original command
33 36
 my $ssh_original_command = $ENV{SSH_ORIGINAL_COMMAND} || '';
37
+warn "ssh_original_command: $ssh_original_command";
34 38
 
35 39
 # IP address
36 40
 my $ip = $ssh_connection || '(no-IP)';
41
+warn "ip: $ip";
37 42
 $ip =~ s/ .*//;
38 43
 
39 44
 # Check new line of SSH original command
... ...
@@ -46,15 +51,19 @@ my ($verb, $project) = parse_ssh_original_command($ssh_original_command);
46 51
 sanity($project);
47 52
 
48 53
 my $rep_home = $git->rep_home;
49
-my $repository = "'$rep_home/$project.git'";
54
+my $repository = "'$rep_home/$user/$project.git'";
50 55
 my @git_shell_cmd = ("git", "shell", "-c", "$verb $repository");
51
-system(@git_shell_cmd) == 0
52
-  or die "Can't execute command: @git_shell_cmd" ;
56
+warn "@git_shell_cmd" if $debug;
57
+
58
+unless ($debug) {
59
+  system(@git_shell_cmd) == 0
60
+    or die "Can't execute command: @git_shell_cmd" ;
61
+}
53 62
 
54 63
 sub parse_ssh_original_command {
55 64
   my $ssh_original_command = shift;
56 65
 
57
-  $ssh_original_command ||= 'info';
66
+  $ssh_original_command ||= '';
58 67
 
59 68
   my $git_commands = "git-upload-pack|git-receive-pack|git-upload-archive";
60 69
   if ($ssh_original_command =~ m(^($git_commands) '/?(.*?)(?:\.git)?'$)) {
... ...
@@ -74,7 +83,6 @@ sub sanity {
74 83
   die "'$project' contains '..'"           if $project =~ m(\.\.);
75 84
 }
76 85
 
77
-
78 86
 =head1 NAME
79 87
 
80 88
 gitprep-shell - AuthorizedKeysCommand for sshd
+31
tmp/memo.txt
... ...
@@ -0,0 +1,31 @@
1
+command="ls",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAurwDPkF1gw5Nf98BhBtPKLBEQ/AdiLIJUEreaa39aWGqzi5s4WBxBP3LMvdvqpMdbnj81ivklJTdlTbKuP4EkhVaXAtB0bw1m/oHPFpp2lH772Bj7ToZQc9omW0bqpP7CtRHCBlf10RIFnhB6ugHSETo4C/esL7OQPThHYvRd8lCGTFq9/4sVd1fWbTcreyXhQA669W+w//xNWla2KnO6+4i/P15SlZfvlgwkziaUHQRZXeVJ0toKuvQRjw5XI18Q3fORnlPALAL4ZV2vUA2Nh4wQGeEkMnXVKF92h+JrXG01filfvnPZZzSnIzVMEyA5ZHV1GhOFUzsogsBKhWrOw== gitprep@www7402u.sakura.ne.jp
2
+
3
+# gitolite start
4
+command="/home/git/gitolite/src/gitolite-shell yuku_t",
5
+no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
6
+ssh-rsa AAAAB3NzaC1y...== yuku_t
7
+# gitolite end
8
+
9
+ssh -p55555 -i ~/tmp/id_rsa_gitprep2 59.106.185.196
10
+
11
+
12
+ssh -p55555 -i ~/tmp/id_rsa_gitprep2 git clone ssh://gitprep@59.106.185.196:55555/home/gitprep/labo/gitprep/data/rep/kimoto/gitprep_t.git
13
+
14
+ssh -p55555 -i ~/tmp/id_rsa_gitprep2 git-upload-pack gitprep_t.git
15
+
16
+
17
+ssh -p55555 59.106.185.196
18
+
19
+
20
+git clone ssh://gitprep@59.106.185.196:55555/gitprep_t.git
21
+
22
+
23
+�‹��ϐ� GIT_SSH
24
+
25
+~/.ssh/config �͑�ϕ֗��ł����A Git �Ƃ͖��֌W�� SSH �ڑ����ɂ�Q�Ƃ����̂ŕs�s���Ȃ��Ƃ���܂��B�ʂ̕�@�Ƃ��āA GIT_SSH �‹��ϐ��� SSH �̃��b�p�[�X�N���v�g��w�肷�邱�Ƃ��ł��܂��B
26
+
27
+git-ssh.sh
28
+#!/bin/sh
29
+exec ssh -oIdentityFile=~/.ssh/github_id_rsa "$@"
30
+$ GIT_SSH=git-ssh.sh git push git@github.com:kyanny/hello.git master
31
+