Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,758
    • Issues 44,758
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,329
    • Merge requests 1,329
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • 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
You need to sign in or sign up before continuing.
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