Skip to content

Older Git clients cannot push when `.git` is omitted from the remote URL

Zendesk: https://gitlab.zendesk.com/agent/tickets/82669

cc/ @DouweM @jramsay

Customer has some RHEL7 instances which come default with Git version 1.8. If a user clones a repository without .git on the end, the clone works fine due to a redirect we have on info/refs. See https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/routes/git_http.rb#L30-48

When the customer attempts to push to the same remote without .git, the older client will fail and the server throws the exception below (no route). Newer instances of Git (> 2) seem to automatically handle this somehow. The customer had two versions of Git on the same server and was testing each using the same working copy. I wonder if the newer client sees the first info/refs redirect and continues to use that base throughout while the old client is 'blind' to it. Do we need to add a redirect for git-upload-pack so older clients work?

Processing by Projects::GitHttpController#info_refs as */*
Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"group", "project_id"=>"test.git"}
Completed 200 OK in 262ms (Views: 0.8ms | ActiveRecord: 18.3ms | Elasticsearch: 0.0ms)
Started POST "/group/test/git-upload-pack" for 10.26.130.38 at 2017-09-28 13:11:09 -0400
ActionController::RoutingError (No route matches [POST] "/group/test/git-upload-pack")
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
Edited by Drew Blessing