Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 55.2k
    • Issues 55.2k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1.6k
    • Merge requests 1.6k
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #3264
Closed
Open
Issue created Aug 26, 2017 by Stan Hu@stanhuOwner

Repository Shortcuts: support remapping of Git repos via SSH

Problem to solve

Customer has legacy git repositories that have no namespace, but since GitLab requires a namespace, they need some way to map their old projects to the new GitLab URL. They have thousands of repositories that need to retain their original remote URLs due to automation.

Further details

They are going to work around this by using gitolite, modifying gitlab-shell, and hooking into SSH_ORIGINAL_COMMAND environment variable to remap the clone. For example, if we need to remap:

project.git => namespace/project.git

The clone request for project.git will appear as git-upload-pack project.git in SSH_ORIGINAL_COMMAND. They'll remap this to git-upload-pack namespace/project.git.

To avoid having to maintain this, we could support some sort of repository mapping that would automatically do this.

Proposal

Add a new Admin API for creating, deleting redirects to Git repos to permit Git repositories to be accessed over SSH or HTTP without a namespace. The API could (but doesn't need to) look like this:

  • GET /api/v4/git_redirects
  • PUT /api/v4/git_redirects/<short>?target=<namespace>/<project> (with project path or ID) (or does POST make more sense?)
  • DELETE /api/v4/git_redirects/<short>

When an SSH (or HTTP) connection tries to access ssh://example.com/<short>.git they will transparently access ssh://example.com/<namespace>/<project>.git

Edited Jun 03, 2019 by James Ramsay (ex-GitLab)
Assignee
Assign to
Time tracking