Cannot connect to GIT from jenkins

I have run Jenkins on AIX with:

java -jar jenkins.war --httpPort=8082

In the Jenkins job configure > Source Code Management > Git, I enter

Repository URL: user@XXX.XXX.XXX.XXX:/opt/git/project.git

where XXX is the ip of the server.

I got the following error message:

Failed to connect to repository : Command "/usr/bin/git ls-remote -h user@XXX.XXX.XXX.XXX:/opt/git/project.git HEAD" returned status code 255:
stdout: 
stderr: exec(): 0509-036 Cannot load program /usr/bin/git because of the following errors:
0509-150   Dependent module /usr/lib/libiconv.a(libiconv.so.2) could not be loaded.
0509-152   Member libiconv.so.2 is not found in archive 

I have tested on both AIX and WinXP. It works fine on the windows machine. But I need the Jenkins to be on the AIX server. Have googled the error but in vain. How can I solve this error?

  • Fetching a URL from a basic-auth protected Jenkins server with urllib2
  • Jenkins + git: “tell me who you are” error, why does it need to tag?
  • How to avoid checkout of sources on master node with jenkins pipeline
  • extract pom version in a jenkins pipeline
  • Restful Versioning - How to version in Version Control and how to Deploy?
  • How do I get jenkins to build every revision of a subversion repository
  • Jenkins HTTPS Git
  • Calling a jenkins build from outside of jenkins?
  • 2 Solutions collect form web for “Cannot connect to GIT from jenkins”

    Make sure you have libiconv installed (either in /usr/… or in /opt), as in this thread or this one.

    find /opt -name "libiconv*" -print
    find /usr -name "libiconv*" -print
    

    Try and unset $LIBPATH.

    Type ldd /usr/bin/git to check where git looks for its dependencies.


    The OP Lai confirms having used one of the solutions:

    When I use ldd /usr/bin/git, it gives /opt/freeware/lib/libiconv.a(libiconv.so.2).
    But the Git error is from /usr/lib/libiconv.a(libiconv.so.2).

    There is a libiconv.la in /opt/freeware/lib but not in /usr/lib.
    I copied it to /usr/lib then it works.

    I run into this even though I have no LIBPATH configured in shell, but processes forked from java had. Consequently, git did not worked when invoked from java but worked just fine otherwise.

    IBM JDK uses LIBPATH to manage own shared libraries but as any environment variable it is inherited by subprocesses where it can cause problems that are not present when LIBPATH is not set at all.

    As IBM JDK prepends existing LIBPATH and not replacing it, it should be enough to set LIBPATH for the java process with all the paths necessary for the forked processes so it will be inherited.

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