Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
b83ab386
Commit
b83ab386
authored
Feb 03, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitlab-shell base implementation
parent
e620575d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
.gitignore
.gitignore
+1
-0
config.yml.example
config.yml.example
+2
-0
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+15
-2
No files found.
.gitignore
0 → 100644
View file @
b83ab386
config.yml
config.yml.example
0 → 100644
View file @
b83ab386
user: git
repos_path: "/home/git/repositories"
lib/gitlab_shell.rb
View file @
b83ab386
require
'open3'
require
'open3'
require
'yaml'
class
GitlabShell
class
GitlabShell
attr_accessor
:username
,
:repo_name
,
:git_cmd
attr_accessor
:username
,
:repo_name
,
:git_cmd
,
:repos_path
def
initialize
def
initialize
@username
=
ARGV
.
shift
@username
=
ARGV
.
shift
@origin_cmd
=
ENV
[
'SSH_ORIGINAL_COMMAND'
]
@origin_cmd
=
ENV
[
'SSH_ORIGINAL_COMMAND'
]
@config
=
YAML
.
load_file
(
File
.
join
(
ROOT_PATH
,
'config.yml'
))
@repos_path
=
@config
[
'repos_path'
]
end
end
def
exec
def
exec
if
@origin_cmd
if
@origin_cmd
parse_cmd
parse_cmd
return
system
(
"git-upload-pack /home/gip/repositories/
#{
@repo_name
}
"
)
if
git_cmds
.
include?
(
@git_cmd
)
process_cmd
else
puts
'Not allowed command'
end
else
else
puts
"Welcome
#{
@username
}
!"
puts
"Welcome
#{
@username
}
!"
end
end
...
@@ -28,4 +36,9 @@ class GitlabShell
...
@@ -28,4 +36,9 @@ class GitlabShell
def
git_cmds
def
git_cmds
%w(git-upload-pack git-receive-pack git-upload-archive)
%w(git-upload-pack git-receive-pack git-upload-archive)
end
end
def
process_cmd
repo_full_path
=
File
.
join
(
repos_path
,
repo_name
)
system
(
"
#{
@git_cmd
}
#{
repo_full_path
}
"
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment