Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
69c18903
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
69c18903
编写于
12月 14, 2012
作者:
R
Riyad Preukschas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update gitlab:check task to use the Gitlab.config.ssh_user setting
上级
190e483f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
19 deletion
+25
-19
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+25
-19
未找到文件。
lib/tasks/gitlab/check.rake
浏览文件 @
69c18903
...
@@ -290,14 +290,15 @@ namespace :gitlab do
...
@@ -290,14 +290,15 @@ namespace :gitlab do
end
end
def
check_gitlab_in_git_group
def
check_gitlab_in_git_group
print
"gitlab user is in git group? ... "
gitolite_ssh_user
=
Gitlab
.
config
.
ssh_user
print
"gitlab user is in
#{
gitolite_ssh_user
}
group? ... "
if
run_and_match
(
"id -rnG"
,
/\Wgit\W/
)
if
run_and_match
(
"id -rnG"
,
/\Wgit\W/
)
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo usermod -a -G
git
gitlab"
"sudo usermod -a -G
#{
gitolite_ssh_user
}
gitlab"
)
)
for_more_information
(
for_more_information
(
see_installation_guide_section
"System Users"
see_installation_guide_section
"System Users"
...
@@ -308,7 +309,8 @@ namespace :gitlab do
...
@@ -308,7 +309,8 @@ namespace :gitlab do
# see https://github.com/gitlabhq/gitlabhq/issues/1059
# see https://github.com/gitlabhq/gitlabhq/issues/1059
def
check_issue_1056_shell_profile_error
def
check_issue_1056_shell_profile_error
print
"Has no
\"
-e
\"
in ~git/.profile ... "
gitolite_ssh_user
=
Gitlab
.
config
.
ssh_user
print
"Has no
\"
-e
\"
in ~
#{
gitolite_ssh_user
}
/.profile ... "
profile_file
=
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
ssh_user
}
/.profile"
)
profile_file
=
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
ssh_user
}
/.profile"
)
...
@@ -510,22 +512,23 @@ namespace :gitlab do
...
@@ -510,22 +512,23 @@ namespace :gitlab do
end
end
def
check_dot_gitolite_user_and_group
def
check_dot_gitolite_user_and_group
print
"Config directory owned by git:git? ... "
gitolite_ssh_user
=
Gitlab
.
config
.
ssh_user
print
"Config directory owned by
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
... "
gitolite_config_path
=
File
.
expand_path
(
"~
#{
Gitlab
.
config
.
ssh_user
}
/.gitolite"
)
gitolite_config_path
=
File
.
expand_path
(
"~
#{
gitolite_
ssh_user
}
/.gitolite"
)
unless
File
.
exists?
(
gitolite_config_path
)
unless
File
.
exists?
(
gitolite_config_path
)
puts
"can't check because of previous errors"
.
magenta
puts
"can't check because of previous errors"
.
magenta
return
return
end
end
if
`stat --printf %U
#{
gitolite_config_path
}
`
==
"git"
&&
# user
if
`stat --printf %U
#{
gitolite_config_path
}
`
==
gitolite_ssh_user
&&
# user
`stat --printf %G
#{
gitolite_config_path
}
`
==
"git"
#group
`stat --printf %G
#{
gitolite_config_path
}
`
==
gitolite_ssh_user
#group
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
puts
"
#{
gitolite_config_path
}
is not owned by
git
"
.
red
puts
"
#{
gitolite_config_path
}
is not owned by
#{
gitolite_ssh_user
}
"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo chown -R
git:git
#{
gitolite_config_path
}
"
"sudo chown -R
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
#{
gitolite_config_path
}
"
)
)
for_more_information
(
for_more_information
(
see_installation_guide_section
"Gitolite"
see_installation_guide_section
"Gitolite"
...
@@ -614,6 +617,7 @@ namespace :gitlab do
...
@@ -614,6 +617,7 @@ namespace :gitlab do
hook_file
=
"post-receive"
hook_file
=
"post-receive"
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git_hooks_path
,
"common"
)
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git_hooks_path
,
"common"
)
gitolite_hook_file
=
File
.
join
(
gitolite_hooks_path
,
hook_file
)
gitolite_hook_file
=
File
.
join
(
gitolite_hooks_path
,
hook_file
)
gitolite_ssh_user
=
Gitlab
.
config
.
ssh_user
gitlab_hook_file
=
Rails
.
root
.
join
.
join
(
"lib"
,
"hooks"
,
hook_file
)
gitlab_hook_file
=
Rails
.
root
.
join
.
join
(
"lib"
,
"hooks"
,
hook_file
)
...
@@ -622,7 +626,7 @@ namespace :gitlab do
...
@@ -622,7 +626,7 @@ namespace :gitlab do
else
else
puts
"no"
.
red
puts
"no"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo -u
git
cp
#{
gitlab_hook_file
}
#{
gitolite_hook_file
}
"
"sudo -u
#{
gitolite_ssh_user
}
cp
#{
gitlab_hook_file
}
#{
gitolite_hook_file
}
"
)
)
for_more_information
(
for_more_information
(
see_installation_guide_section
"Setup GitLab Hooks"
see_installation_guide_section
"Setup GitLab Hooks"
...
@@ -638,6 +642,7 @@ namespace :gitlab do
...
@@ -638,6 +642,7 @@ namespace :gitlab do
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git_hooks_path
,
"common"
)
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git_hooks_path
,
"common"
)
gitolite_hook_file
=
File
.
join
(
gitolite_hooks_path
,
hook_file
)
gitolite_hook_file
=
File
.
join
(
gitolite_hooks_path
,
hook_file
)
gitolite_hook_content
=
File
.
read
(
gitolite_hook_file
)
gitolite_hook_content
=
File
.
read
(
gitolite_hook_file
)
gitolite_ssh_user
=
Gitlab
.
config
.
ssh_user
unless
File
.
exists?
(
gitolite_hook_file
)
unless
File
.
exists?
(
gitolite_hook_file
)
puts
"can't check because of previous errors"
.
magenta
puts
"can't check because of previous errors"
.
magenta
...
@@ -652,7 +657,7 @@ namespace :gitlab do
...
@@ -652,7 +657,7 @@ namespace :gitlab do
else
else
puts
"no"
.
red
puts
"no"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo -u
git
cp
#{
gitlab_hook_file
}
#{
gitolite_hook_file
}
"
"sudo -u
#{
gitolite_ssh_user
}
cp
#{
gitlab_hook_file
}
#{
gitolite_hook_file
}
"
)
)
for_more_information
(
for_more_information
(
see_installation_guide_section
"Setup GitLab Hooks"
see_installation_guide_section
"Setup GitLab Hooks"
...
@@ -708,7 +713,8 @@ namespace :gitlab do
...
@@ -708,7 +713,8 @@ namespace :gitlab do
end
end
def
check_repo_base_user_and_group
def
check_repo_base_user_and_group
print
"Repo base owned by git:git? ... "
gitolite_ssh_user
=
Gitlab
.
config
.
ssh_user
print
"Repo base owned by
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
? ... "
repo_base_path
=
Gitlab
.
config
.
git_base_path
repo_base_path
=
Gitlab
.
config
.
git_base_path
unless
File
.
exists?
(
repo_base_path
)
unless
File
.
exists?
(
repo_base_path
)
...
@@ -716,14 +722,14 @@ namespace :gitlab do
...
@@ -716,14 +722,14 @@ namespace :gitlab do
return
return
end
end
if
`stat --printf %U
#{
repo_base_path
}
`
==
"git"
&&
# user
if
`stat --printf %U
#{
repo_base_path
}
`
==
gitolite_ssh_user
&&
# user
`stat --printf %G
#{
repo_base_path
}
`
==
"git"
#group
`stat --printf %G
#{
repo_base_path
}
`
==
gitolite_ssh_user
#group
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
puts
"
#{
repo_base_path
}
is not owned by
git
"
.
red
puts
"
#{
repo_base_path
}
is not owned by
#{
gitolite_ssh_user
}
"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo chown -R
git:git
#{
repo_base_path
}
"
"sudo chown -R
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
#{
repo_base_path
}
"
)
)
for_more_information
(
for_more_information
(
see_installation_guide_section
"Gitolite"
see_installation_guide_section
"Gitolite"
...
@@ -773,6 +779,7 @@ namespace :gitlab do
...
@@ -773,6 +779,7 @@ namespace :gitlab do
hook_file
=
"post-receive"
hook_file
=
"post-receive"
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git_hooks_path
,
"common"
)
gitolite_hooks_path
=
File
.
join
(
Gitlab
.
config
.
git_hooks_path
,
"common"
)
gitolite_hook_file
=
File
.
join
(
gitolite_hooks_path
,
hook_file
)
gitolite_hook_file
=
File
.
join
(
gitolite_hooks_path
,
hook_file
)
gitolite_ssh_user
=
Gitlab
.
config
.
ssh_user
unless
File
.
exists?
(
gitolite_hook_file
)
unless
File
.
exists?
(
gitolite_hook_file
)
puts
"can't check because of previous errors"
.
magenta
puts
"can't check because of previous errors"
.
magenta
...
@@ -792,7 +799,7 @@ namespace :gitlab do
...
@@ -792,7 +799,7 @@ namespace :gitlab do
unless
File
.
exists?
(
project_hook_file
)
unless
File
.
exists?
(
project_hook_file
)
puts
"missing"
.
red
puts
"missing"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo -u
git
ln -sf
#{
gitolite_hook_file
}
#{
project_hook_file
}
"
"sudo -u
#{
gitolite_ssh_user
}
ln -sf
#{
gitolite_hook_file
}
#{
project_hook_file
}
"
)
)
for_more_information
(
for_more_information
(
"lib/support/rewrite-hooks.sh"
"lib/support/rewrite-hooks.sh"
...
@@ -806,7 +813,7 @@ namespace :gitlab do
...
@@ -806,7 +813,7 @@ namespace :gitlab do
else
else
puts
"not a link to Gitolite's hook"
.
red
puts
"not a link to Gitolite's hook"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo -u
git
ln -sf
#{
gitolite_hook_file
}
#{
project_hook_file
}
"
"sudo -u
#{
gitolite_ssh_user
}
ln -sf
#{
gitolite_hook_file
}
#{
project_hook_file
}
"
)
)
for_more_information
(
for_more_information
(
"lib/support/rewrite-hooks.sh"
"lib/support/rewrite-hooks.sh"
...
@@ -860,7 +867,6 @@ namespace :gitlab do
...
@@ -860,7 +867,6 @@ namespace :gitlab do
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
puts
"
#{
repo_base_path
}
is not owned by git"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo service gitlab restart"
,
"sudo service gitlab restart"
,
"or"
,
"or"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录