Question

Using github for windows on same machine, with same credentials works fine. Can pull/clone.

However teamcity installed as a windows service on the same machine, returns the following error

List remote refs failed: org.eclipse.jgit.errors.TransportException: https://github.com/my-private-repo.git: not authorized
Was it helpful?

Solution

In teamcity, in the project VCS Root, if the authentication method is based on ssh public/private key, then the fetch URL should be like git@github.com:.../repository.git. Using https:// in the fetch URL causes the error message:

List remote refs failed: org.eclipse.jgit.errors.TransportException..

to occur.

OTHER TIPS

In bitbucket, i resolved this by creating an App Password under settings, and used the app password instead of my bitbucket password

Had the same issue and resolved it by creating a Personal Access Token in Github and using it as a password in TeamCity.

Having same error with Stash (=Bitbucket server) and solution was to give the user specified in TeamCity the permissions in Stash to access the repository. Permissions are per-repository.

In case anyone else has something similar, it was the user credentials in GitHub, but I have not tracked down exactly which setting yet.

Using a different user within TeamCity works, even though I could perform a clone/fetch/pull and ls remote on command line (as the problem user).

You can use SSH KEYS to allow you to access the Azure TFS GIT URL, or you can modify the settings in "Alternative Credentials" by checking "Enable alternate credentials" so you can access the repository by just using a username and password.

First in Azure DevOps go to your project:

enter image description here

Then choose Security in the RHS menu:

enter image description here

Finally choose "Alternate Credentials" in the LHS menu and click the "Enable authentication alternate credentials" where you will then put in your username and password:

enter image description here

Please beware that this is less secure than using the SSH KEYS.

To anyone encountering this issue with using Bitbucket.

Since March 2022, you cannot use your personal credentials to connect your apps to bitbucket anymore. You need to create an app password (see here how to do it).

The identifier will not be your email adress but your Bitbucket username.

I had the same error for a git server hosted on IIS.

The problem came on the scene after installing 'basic authentication' for the IIS. After that, the new authentication method 'basic authentication' was enabled (seems to be the default) for the git server's website. Disable 'basic authentication' solved the problem.

Maybe not that related, but you may come here by the keywords "teamcity, github, list remote refs failed."

For those whose server is behind a proxy, please set the proxy for TeamCity server according to Connection time out: github.com

The main idea is:

To enable TeamCity to use proxy, an environment variable has to be created:

Name: TEAMCITY_SERVER_OPTS

Value: -Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=80 -Dhttps.proxyHost=192.168.0.1 -Dhttps.proxyPort=80

Try to make push/get with same credentials with local git client it could provide more details, which could be related to credentials.

This was to me since TeamCity showed same error and these solutions didnt worked.

Had the same problem with my Repo in Azure DevOps so I went to Clone then Command line selected HTTPS, Copied the url, Username and password which I used in TeamCity. enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top