Failed to perform checkout on agent using GitHub's Personal Access Token

Hello Everyone!

I try to set up the VSC Root to use GitHub's Personal Access Token (either classic or fine-grained). I am using the on-premise TeamCity Professional 2023.11.2 (build 147486) version. So I set the Authentication method to “Password / personal access token”, The Username was left empty, and pasted my personal access token to the “Password / access tokeninput field in the Authentication Settings of the VSC Root.

“Test connection” shows “Connection successful!”, so at least at this point, it's ok. However, when I try to run my build configuration I get an error during the checkout (see the code block below).

It's worth mentioning that SSH keys work just fine. Recently we decided to switch over GitHub's personal access tokens, and we have
issues with the simplest workflow. Also, when I tried to pull the repository manually via cmd using the personal access token it worked.
What am I missing in the VSC root configuration or the TeamCity configuration?

I really appreciate any help you can provide. :)

PS (today I've discovered):
- Server side check-out works
- Agent side check-out doesn't work (IDK, something related to the SSH, but why?)


  [14:20:18.179] INFO Connecting to port 22
  [14:20:18.221] INFO Connection established
  [14:20:18.414] INFO Remote version string: SSH-2.0-babeld-579dccec
  [14:20:18.414] INFO Local version string: SSH-2.0-TeamCity-Agent-2023.11.2-JSCH-0.1.67


  [14:20:18.625] WARN Permanently added '' (EDDSA) to the list of known hosts.
  [14:20:18.625] INFO SSH_MSG_NEWKEYS sent
  [14:20:18.625] INFO SSH_MSG_NEWKEYS received
  [14:20:18.630] INFO SSH_MSG_SERVICE_REQUEST sent
  [14:20:18.735] INFO SSH_MSG_EXT_INFO received


  [14:20:18.741] INFO SSH_MSG_SERVICE_ACCEPT received
  [14:20:18.851] INFO Authentications that can continue: publickey,keyboard-interactive,password
  [14:20:18.851] INFO Next authentication method: publickey
  [14:20:18.860] INFO Disconnecting from port 22
  Auth fail
  fatal: Could not read from remote repository.
  Please make sure you have the correct access rights
  and the repository exists.
1 comment

I've found the issue, the git configuration on my agent was messed up (a bunch of `.insteadof` which alters https and git@).
Maybe it will be helpful for someone.


Please sign in to leave a comment.