Any way to disable http access to repositories?

2,586 views
Skip to first unread message

Brian Levine

unread,
Feb 21, 2013, 11:09:04 AM2/21/13
to gitl...@googlegroups.com
Hello,

I'm managing a number of Git repos under Gitlab.  I'd like to allow only SSH access to those repos.  In other words, I'd like to disable smarthttp access.  Ideally, the HTTP URL would not even show up in the repos UI.  But I'll settle for just being able to deny HTTP access to repos. Is there any way to do this (other than hacking the source of course).

Thanks.

-brian

Brian Levine

unread,
Feb 27, 2013, 10:57:51 AM2/27/13
to gitl...@googlegroups.com
Noone has any insights on this?

-brian

Erik Anderson

unread,
Feb 28, 2013, 3:18:07 PM2/28/13
to gitl...@googlegroups.com
On Thu, Feb 21, 2013 at 10:09 AM, Brian Levine <blevi...@gmail.com> wrote:
I'm managing a number of Git repos under Gitlab.  I'd like to allow only SSH access to those repos.  In other words, I'd like to disable smarthttp access.  Ideally, the HTTP URL would not even show up in the repos UI.  But I'll settle for just being able to deny HTTP access to repos. Is there any way to do this (other than hacking the source of course).

I've also been wondering about this.

There is an open issue in github on this (https://github.com/gitlabhq/gitlabhq/issues/1536), but unfortunately it is seemingly being ignored.

Can any of the devs comment on whether or not this feature will be implemented and if so, what release it has been targeted to?

Thanks
-Erik

James Newton

unread,
Feb 28, 2013, 3:21:37 PM2/28/13
to gitl...@googlegroups.com
You could possibly disable it by getting rid of the Grack lines in config/routes.rb.


--
James Newton



--
You received this message because you are subscribed to the Google Groups "GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitlabhq+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brian Levine

unread,
Feb 28, 2013, 3:29:56 PM2/28/13
to gitl...@googlegroups.com
I actually figured out one way.  Although it required hacking the gitlab code.  I did the following:

In .../gitlab/config/routes.rb I commented out the Grack support so that HTTP requests for repos wouldn't even be routed.

# Disable Grack support                                                                                                                                                         
#  mount Grack::Bundle.new({                                                                                                                                                     
#    git_path:     Gitlab.config.git.bin_path,                                                                                                                                   
#    project_root: Gitlab.config.gitolite.repos_path,                                                                                                                            
#    upload_pack:  Gitlab.config.gitolite.upload_pack,                                                                                                                           
#    receive_pack: Gitlab.config.gitolite.receive_pack                                                                                                                           
#  }), at: '/', constraints: lambda { |request| /[-\/\w\.-]+\.git\//.match(request.path_info) }


In .../gitlab/app/views/shared/_clone_panel.html.haml, I disabled the HTTP button:

%button{:disabled => true, class: "btn", :"data-clone" => @project.http_url_to_repo}= Gitlab.config.gitlab.protocol.upcase

After this, you need to issue the following command to re-compile that HAML file. From .../gitlab :

rake assets:precompile

I don't necessarily recommend this approach, but until I hear about something better...

Hope this helps.

-brian

Erik Anderson

unread,
Mar 6, 2013, 2:20:42 AM3/6/13
to gitl...@googlegroups.com
Thanks, Brian.

Those changes worked perfectly.

-Erik


Reply all
Reply to author
Forward
0 new messages