Erik Z
Erik Z

Reputation: 4770

How can I use an access token for accesing Visual Studio Team Services (was Visual Studio Online) from inside Visual Studio Code?

I'm trying to use the Git client inside Visual Studio Code. I have my Git repository on Team Services. In the Team Services site, I've created a "personal access token". When I try to pull from inside my Visual Studio Code I get the following screen.

Enter image description here

Can I use my access token in this dialog? I've tried different usernames, but authentication always fails.

Upvotes: 1

Views: 10336

Answers (3)

Esther Fan - MSFT
Esther Fan - MSFT

Reputation: 8516

This topic or links from this topic might help: Use Git Credential Managers to Authenticate to Visual Studio Team Services

It looks like there's also an Visual Studio Team Services extension for Visual Studio Code now that handles credential storage.

Upvotes: 0

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29968

I would recommend you to use Git Credential Manager. With this tool installed, you will get a "Sign in" dialog for Visual Studio Online when you pull from Visual Studio Code. You can simply enter your Visual Studio credentials in the dialog to sign in and the tool will manage the Git credentials automatically.

Enter image description here

Upvotes: 1

CodeWizard
CodeWizard

Reputation: 142054

This article describe in details how to do it.

From the above article:

enter image description here

When you create the token, you see a token (only visible after creation !) that you should copy and keep safe.

enter image description here

This token alone is sufficient to authenticate against VSO. So when you now clone a Git repository you only have to fill in this token in the password box. Username can be empty or any value

enter image description here

The great thing is that you can revoke rights or the token afterwards and make sure that people cannot access stuff anymore

Upvotes: 5

Related Questions