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
e620575d
Commit
e620575d
authored
Feb 03, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working git upload
parent
bb9863e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
+38
-4
bin/gitlab-shell
bin/gitlab-shell
+7
-4
lib/gitlab_shell.rb
lib/gitlab_shell.rb
+31
-0
No files found.
bin/gitlab-shell
View file @
e620575d
#!/usr/bin/env ruby
#!/usr/bin/env ruby
unless
ENV
[
'SSH_CONNECTION'
]
puts
"Only ssh allowed"
exit
end
#
#
# GitLab shell, invoked from ~/.ssh/authorized_keys
# GitLab shell, invoked from ~/.ssh/authorized_keys
#
#
ROOT_PATH
=
File
.
join
(
File
.
expand_path
(
File
.
dirname
(
__FILE__
)),
".."
)
ROOT_PATH
=
File
.
expand_path
(
'..'
,
__FILE__
)
require
File
.
join
(
ROOT_PATH
,
'lib'
,
'gitlab_shell'
)
GitlabShell
.
new
.
exec
puts
ENV
[
'SSH_CONNECTION'
].
inspect
exit
exit
lib/gitlab_shell.rb
0 → 100644
View file @
e620575d
require
'open3'
class
GitlabShell
attr_accessor
:username
,
:repo_name
,
:git_cmd
def
initialize
@username
=
ARGV
.
shift
@origin_cmd
=
ENV
[
'SSH_ORIGINAL_COMMAND'
]
end
def
exec
if
@origin_cmd
parse_cmd
return
system
(
"git-upload-pack /home/gip/repositories/
#{
@repo_name
}
"
)
else
puts
"Welcome
#{
@username
}
!"
end
end
protected
def
parse_cmd
args
=
@origin_cmd
.
split
(
' '
)
@git_cmd
=
args
.
shift
@repo_name
=
args
.
shift
end
def
git_cmds
%w(git-upload-pack git-receive-pack git-upload-archive)
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