0
votes

I have just setup a new repo on GitHub and added a .NET Core solution. I have create a Personal Access Token in GitHub.

In Visual Studio Team Services online, I've set the "Get sources" to use GitHub and chose to use my PAT, pasted the token string in. It lights up green to indicate a connection was established and indeed I am able to pick the repo I need.

The build on the hosted cloud agent fails though:

2018-02-01T12:56:18.3505619Z ##[section]Starting: Get Sources
2018-02-01T12:56:18.5131672Z Syncing repository: lukepuplett/standard-extensions (GitHub)
2018-02-01T12:56:18.5218130Z Prepending Path environment variable with directory containing 'git.exe'.
2018-02-01T12:56:18.9399524Z ##[command]git version
2018-02-01T12:56:20.4345074Z git version 2.14.3.windows.1
2018-02-01T12:56:20.4697423Z ##[command]git lfs version
2018-02-01T12:56:27.9772252Z git-lfs/2.3.4 (GitHub; windows amd64; go 1.8.3; git d2f6752f)
2018-02-01T12:56:28.0252003Z ##[command]git init "d:\a\1\s"
2018-02-01T12:56:28.9023657Z Initialized empty Git repository in d:/a/1/s/.git/
2018-02-01T12:56:28.9083315Z ##[command]git remote add origin https://github.com/lukepuplett/standard-extensions.git
2018-02-01T12:56:29.1145696Z ##[command]git config gc.auto 0
2018-02-01T12:56:29.3007766Z ##[command]git config --get-all http.https://github.com/lukepuplett/standard-extensions.git.extraheader
2018-02-01T12:56:29.3334527Z ##[command]git config --get-all http.proxy
2018-02-01T12:56:29.3767712Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ********" fetch --tags --prune --progress --no-recurse-submodules origin
2018-02-01T12:56:37.4510516Z fatal: could not read Username for 'https://github.com': terminal prompts disabled
2018-02-01T12:56:39.5779857Z ##[error]Git fetch failed with exit code: 128
2018-02-01T12:56:39.6331761Z ##[section]Finishing: Get Sources

I was expecting this to just work, especially given that the build definition editor UI lights up okay.

I just ran the build a couple of times so I could see any events logged in the Security bit over on GitHub but nothing it mentioned, which is odd.

Note: I have 2FA setup.

Has anyone got this out-of-box feature working from VSTS?

1
When you created the PAT in GitHub, what permissions did you check off? For grins and giggles, I'd create a new one with every permission checked, just to rule out a permissions issue. FYI, using PAT's works for me, though I'm hitting public repositories, not private. - raterus
I added all the correct-looking repo ones, I checked again, too. But I like the idea. - Luke Puplett
Hmm, quick check just now - I can "browse" the repo from the build definition editor; if I add a Copy Files step then I can hit [...] and pick a file, so it's pulled the repo down, I guess. - Luke Puplett
Try running the same commands locally from the command prompt, providing the same PAT during the fetch step. Does it work?, then it's something wrong in VSTS, Does it fail? It's probably something wrong with GitHub. - raterus
@LukePuplett What if disable two-factor authentication and then build in VSTS again? - Marina Liu

1 Answers

1
votes

After an investigation by Microsoft support and myself we discovered it was a corrupt token from GitHub somehow.

The support guy could not reproduce it; it worked on his machine ;)

Making a new token with all the permissions worked. Then I removed all the permissions back to the same applied to the problem token and it continues to work fine.