Home > other >  How can I import a repository into an Azure DevOps Project using SSH?
How can I import a repository into an Azure DevOps Project using SSH?

Time:11-04

I'm trying to migrate a bunch of projects from a corporate Gitlab account to Azure DevOps. Az Devops has a handy "Import a repository" option... but it only has a field for a Clone URL (ie https).

Import a Git Repository

Is there a way for me to use SSH? The Gitlab account I'm migrating from has HTTPS disabled.

I added my SSH key to Az Devops, tried using the SSH link in the field, tried using a hand-crafted https (obviously didn't work).

I tried finding a command to do it from Git CLI but couldn't find anything. The closest I've found is creating a brand new repo, copying everything from the old repo, and pushing to the new one.

CodePudding user response:

SSH authentication is not supported, but you can manually import a repository that uses SSH authentication by following the steps using git CLI. The reference document is here:Import a Git repo into your project

1 Clone the source repo to a temporary folder on your computer

git clone [email protected]:{your account} /demo.git
cd demo.git

2 Run the following command to copy the source repo to the target repo.

  git push --mirror https://dev.azure.com/{organization name} /{project name} /_git/{target repo name}
  • Related