2

I've installed Gitlab on my server and I don't know if what I'm willing to do is possible.

I want to set Gitlab to monitorize my repos, with all the goodies that come with it, but I don't want to use gitlab urls, since I don't want to force such a pain in the neck for all the devs using the repos.

Gitlab's own "Import" feature seems to create its own urls, so that would not be what I'm looking for.

My question is: Is there a way to use gitlab with the old bare git urls?

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47

2 Answers2

1

Unfortunately gitlab relies on its url schema to get its group/user permissions per repo.

The only way I can image is that one could use custom rewrite rules in the frontend web server. These rules then would rewrite all requests appropriately to the gitlab naming schema. This would of course require that your developers only used http(s) to access the repos. This approach would not break your code from the upstream code base.

However, if you were using ssh:// as well (which is recommended by git), the only way I see is that you do a rewrite of the path in the gitlab-shell: The class GitlabShell has a this parse_cmd method

def parse_cmd
  args = Shellwords.shellwords(@origin_cmd)
  @git_cmd = args[0]
  @repo_name = escape_path(args[1])
end

in which you could fiddle around with @repo_name. This approach would break your code from the upstream code base.

I'm sorry but as you did not specify any example repo path its hard to make up a more concrete example.

Personally I'd go with the migration to import the repos and publish the new urls. If you can provide a list of git remote set-url origin ssh://git@gitlab.acme.com/newgroup/imported.git to your colleagues that would minimize the work on their side I guess.

Marvin Frick
  • 196
  • 4
1

My short answer is "No".

It's not such a problem to change or add a new remote to an existing repository. Simply do git remote add gitlab git@<server>/owner/repository_link.git (or whatever that link would be) in the project and you are done. If you want to replace the "origin" remote, you can see what to do even manually in your .git folder. So I would not be so concerned with the new URL's, simply document what needs to be done, and notify them you have moved.

vgoff
  • 418
  • 7
  • 19