How to see if git binary is using openssl or gnutl

2019-07-07 17:06发布

问题:

I'm trying to debug a strange issue with git clone, https protocol, of one specific repo using Ubuntu with a corporate proxy. The same thing works in CentOS, Fedora distros but not on Ubuntu or Debian in our environment.

Apparently in Ubuntu packages git is using gnutls, but on other platform openssl. However building from sources, even on Ubuntu, uses openssl according to this.

Is there a way for me to check from a given git installation which one the binary is using? Some output that would tell me?

These questions are related, but both talk about changing it either runtime or build time - at this point I would just need the info about which one it is.

回答1:

$ cd /usr/lib/git-core
$ ./git --version
git version 1.9.1
$ ldd git-http-fetch | grep libcurl
    libcurl-gnutls.so.4 => /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007f8d5dcdf000)

$ cd /usr/libexec/git-core
$ ./git --version
git version 2.8.1
$ ldd git-http-fetch | grep libcurl
    libcurl-gnutls.so.4 => /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007f6bd1e42000)

So apparently both my operating-system supplied version and my self-compiled version are against gnutls.

Edit: this is what openssl output looks like when the same command is run, there is no libcurl-gnutls, but

libcurl.so.4 => /usr/lib/x86_64-linux-gnu/libcurl.so.4 (0x00007fe96267e000)

Edit2: looking at this answer, seems git at runtime is just using whatever libcurl the system is set up to use, so my question was a bit misleading. Anyway, this answer is correct in the sense that it will tell which one is being used.