Ankur
Ankur

Reputation: 11

Not able to clone vsts repo in my local jenkins via alternate git credential

Not able to clone vsts repo in my local jenkins via alternate git credential, my jenkins is on MACOS. The solution below is not working for me, please assist.

Build hangs at
Cloning the remote Git repository Cloning repository https://yyyy.visualstudio.com/DefaultCollection/Subway%20Digital%20DevOps/_git/zzzz

git init /Users/Shared/Jenkins/Home/workspace/Test_Digital_Devops_repo # timeout=10 Fetching upstream changes from https://yyyy.visualstudio.com/DefaultCollection/zzzz/_git/zzzz git --version # timeout=10 using GIT_ASKPASS to set credentials Standalone123n git fetch --tags --progress https://yyyy.visualstudio.com/DefaultCollection/zzzz/_git/zzzz +refs/heads/:refs/remotes/origin/

Upvotes: 1

Views: 371

Answers (1)

Marina Liu
Marina Liu

Reputation: 38136

The URL for VSTS git repo should be:

https://account.visualstudio.com/DefaultCollection/project/_git/repo

To provider alternate credential during git clone, you should use the URL as:

https://SeconaryUsername:[email protected]/DefaultCollection/project/_git/repo

So when you execute git clone https://SeconaryUsername:[email protected]/DefaultCollection/project/_git/repo, it can clone the VSTS git repo successful.

BTW: you can also provider personal access token (PAT) for authentication. The URL format shoule be:

https://Personal%20Access%20Token:[email protected]/project/_git/repo

Upvotes: 1

Related Questions