Search code examples
gitazurevisual-studio-codeazure-devopsazure-repos

How to Connect Visual Studio Code with Azure GIT Repo


I want to connect Visual Studio Code with Azure GIT Repo.

For this I have Azure GIT Repo with empty files, installed VS Code which have following details and installed Azure extension (Argutec Azure Repos)

enter image description here

When I type >Team: Signin I get following error

(team) No Azure DevOps Services or Team Foundation Server repository configuration was found. Ensure you've opened a folder that contains a repository.

And also some time I get following error

Command 'Team: Signin' resulted in an error (command 'team.Signin' not found)

how I can git rid of above error. the project I have on my local system which needs to be uploaded under Azure git repo

EDIT Also I have given the path under Tvc: Location

C:\\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe

Solution

  • To connect VS Code with Git repository from Azure Repos, you can try like as below:

    1. If you want push you local code to a new Git repository on Azure Repos.

      • Create an empty Git repository on Azure Repos. This repository does not contain any code files. enter image description here

      • Open the folder of your local code on VS Code.

      • Go to 'Source Control' tab on VS Code, if you local source code folder has not been initialized as a local Git repository, click 'Initialize Repository'.

      • After the initialization, add the empty repository on Azure Repos as the remote of the local repository. You can navigate to '...' > 'Remote' > 'Add Remote...', enter the clone URL of the remote empty repository, and provide a remote name. When the first time to connect the remote, you may be asked to provide your login authentication such as you email and password.

      • Commit and push the code files from the local repository to the remote repository. After completing the push, you can open or refresh the web page of the remote repository, then you can see the code files haven been pushed to the remote. enter image description here

    2. If you want to connect to an existing and not empty remote Git repository on Azure Repos.

      • Open VS Code to clone the remote repository to local.

      • Navigate to 'Source Control' tab on VS Code, click 'Clone Repository', enter the clone URL of the remote repository. After completing the clone, you can click the 'Open' button to directly open the local repository on VS Code. When the first time to connect the remote, you may be asked to provide your login authentication such as you email and password. enter image description here

      • After you make some changes on the local repository, then commit and push these changes to the remote repository. enter image description here