this is tricky, problem is with apple's provided openssl (v. 0.9.8) library is failing when connection go the SNI (vitrual ssl hosts).

Issue is showing e.g. with git build against libcurl (where libcurls is using system's openssl).

example log from the communication:
https://gist.github.com/anonymous/8f6533a755ae5c710c75

what's happening is that ssl session is being reset, but consequent calls to the host are missing indication of the virtual host name, in result server is sending a default ssl certificate not a virtual host's one, this leads to certificate error  as cannonical names will not match.

compilin curl/libcurl against brewed openssl or alternative: gnutls/polarssl resolves this issue.

discussion about this error was held on the git mailinglist with maintainer of curl.