'cloning azure devops git repository through visual studio 2017 throws error

I have created an organization in Azure DevOps. Under this organization, I created a project with private Git Repository in Azure DevOps. Now When I try to clone this repository using Visual Studio 2017 I keep getting below mentioned error.

**Git failed with a fatal error.
unable to access 'https://dev.azure.com/organizationame/projectname/_git/projectname/': The requested URL returned error: 403**


Solution 1:[1]

I tested this in visual studio by the following steps ,every thing works well.

1.Connect to a project in Team Explorer

enter image description here

2.On the Connect to a Project page, select the repo you want to clone.

enter image description here

3.If a window pops up that requires credentials, enter your PAT and make sure your PAT has Read, write & manage permission in section Code.

enter image description here

4.The repository was cloned successfully.

enter image description here

If you have followed the steps but failed, please indicate at which step you got the error.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hugh Lin