Teamcity and git repository, connection fails

I am getting this error when doing a test connection against my git repository (located on AppHarbor) from TeamCity 6.5. Can anybody explain this error more closely?

invalid advertisement of 001E# service=git-upload-pack

  • TeamCity - Git push from agent
  • TeamCity fails to trigger on wildcard-specified branch
  • TeamCity + git and authentication for submodules
  • Extracting git hash and use it in gradle
  • TeamCity build - VCS trigger/Branch specification not working as intended
  • Managing multiple SSH keys with TeamCity
  • Is it possible to specify git.exe location during server-side checkout
  • Cannot fetch from git in Team City 8.1.2
  • 3 Solutions collect form web for “Teamcity and git repository, connection fails”

    This is most likely caused by a bad interaction between the TeamCity JGit-based client and AppHabor’s WebGitNet-based Git-implementation. The same symptoms are mentioned here. I’m going to try and see if we can back-port that patch.

    Edit: As rarouš mentions, using the Github integration (or a git repository at Bitbucket) is also a really good option.

    I checked network interaction with Wireshark and I found that JGit which TeamCity uses treats this packet as incorrect:

    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Type: application/x-git-upload-pack-advertisement; charset=utf-8
    Server: Microsoft-IIS/7.5
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Date: Thu, 05 Jan 2012 09:56:30 GMT
    Content-Length: 255
    
    001d# service=git-upload-pack ... <other stuff>
    

    Precisely it is confused by charset=utf-8 part (which was added when call to response.Write(string) is performed). msysgit handles such packet correctly, though.

    This fixes the issue by replacing Write(string) with binary write. Other option is to specify response.Charset = null; explicitly.

    I tested info on GitWebAccess which has similar problems and made pull request with fix here.

    I got the same error when trying to checkout a project from Eclipse with EGit. In my case I simply gave the wrong project path. If you come here because you got this error -> check your repository path first

    Git Baby is a git and github fan, let's start git clone.