It takes a LIBSSH2_SESSION
because it's a libssh2 callback; it's not low-level, it's orthogonal to the workings of libgit2.
The function is provided for you to sign the data yourself. It's provided mostly for completeness, as the underlying functionality is an undocumented quirk of libssh2.
See e.g. http://www.libssh2.org/libssh2_userauth_publickey.html and http://www.libssh2.org/mail/libssh2-devel-archive-2012-10/0071.shtml