Import a Git repo

Last Update: 3/6/2017

Team Services | TFS 2017 Update 1

Import an existing Git repo from GitHub, BitBucket, GitLab, or other location into a new or empty existing repo in your Team Project.

Import into a new repo

From the repo drop-down, select Import repository.

Import Repository Option

If the source repo is publicly available, just enter the clone URL of the source repository and a name for your new Git repository.

If the source repository is private but can be accessed using basic authentication (username-password, personal access token, etc.), select Requires authorization and enter the your credentials.

Import Repository Dialog

Import into an existing empty repo

On the Files page of the empty Git repository, select Import repository and enter the clone URL. You will need to provide credentials if the source repository requires authentication.

Import Repository into an existing repository

Troubleshooting

Although most of the time the import is successful, certain conditions can cause problems.

Source repository is behind two-factor authentication

The import service uses REST APIs to validate and trigger import and cannot work directly with repositories that require two-factor authentication. Most Git hosting providers like GitHub and Team Services support personal tokens which can be supplied to the import service.

Source repository does not support multi_ack

The import service uses the multi_ack capability of the Git protocol during the import. If the source repository does not provide this capability, the import service can fail to import from the given source. This failure can happen when creating import request or while import is in progress.

Importing from a previous version of Team Foundation Server

If the source Git repository is in a TFS version earlier than TFS 2017 RTM, then import will fail. This happens because of a contract mismatch between latest TFS/Team Services and pre-2017 RTM versions of TFS.

MSA based credentials will not work

Import service relies on basic authentication to communicate with the source repository.If the username / password you are using are not basic auth then authentication will fail and import will fail. One way to check if the username / password you are using are basic auth or not is to try using git.exe to clone your repository using the below format

`git clone https://<<username>>:<<password>>@<<remaining clone Url>>`