Git Failed to connect to repository : Could not init tmp

Issue

Trying to setup a GIT repository on the SCM section for a job, the following error appears on the GUI:

Failed to connect to repository : Could not init /your/path/to/a/filetmp

In certain situations, the job is executed properly even with this issue.

Environment

  • Jenkins
  • Jenkins LTS
  • CloudBees Jenkins Enterprise
  • Git Plugin

Resolution

Follow these steps:

1) Check if Git is installed on the Jenkins server. If so, find path to the Git executable by:

  • Unix System: which git.
  • Windows System: where git.

2) Check if the Git Executable Path is properly set under Manage Jenkins > Global Tool Configuration > Git > Path to Git executable (for CJP 1.x it is under Manage Jenkins > Configure System > Git > Path to Git executable).

  • Unix System, example: /usr/bin/git.
  • Windows System example C:/Program Files (x86)/Git/bin/git.exe. Do not forget to include ‘.exe’ extension

Note: Make sure not to include any white space at the end of your path.

Have more questions? Submit a request

4 Comments

  • 0
    Avatar
    Lee Meador

    How do you tell a pipeline script which of multiple git paths to select? This could be multiple git versions or it could be differing paths between windows and linux node agents.

  • 0
    Avatar
    Allan Burdajewicz

    Hello Lee,

    The tool path locations in Manage Jenkins > Global Tool Configuration are the "default" location. 

    This configuration can be overridden for a specific agent in the node configuration. Under Manage Jenkins > Manage Nodes > $NODE_NAME > Configure in the section Node Properties > Tool Locations. You can set the location of a specific tool on this agent.

    See also How to Manage Build Tools on Client Master

    From a job - or a pipeline script - the tool path used for the job depends on the node allocated. If the job runs on the master, the path defined in the global configuration is used. If it runs on a node, the path defined on the agent configuration is used and if there is none, fallbacks to the global configuration.

    Edited by Allan Burdajewicz
  • 0
    Avatar
    Denys Digtiar

    Hi Lee,

    If you have more than one Git tool configured and you need to select between them in the Pipeline, please use a checkout step in Snippet Generator. It will give you an option called Git executable which will list all the available Git tools.

  • 0
    Avatar
    Lee Meador

    Thanks Allan and Denys for the quick response

    We found an obscure reference about what Denys said and can use that. And are.

    As for Allan's suggestion, that would work except for a strange "problem". We are using cloud slaves set up in our CJOC. Since the CJOC can't install the Git plugin, git is not an option on the Global Tools config and we have to configure our Git tools at the master level. That means the Node Properties > Tool Locations on the Agent (which is configured on the CJOC) doesn't offer the possibility of entering a git tool.

    I know the git plugin could be installed by upload on the CJOC. That's a workaround I haven't completely figured out because of all the plugin dependencies and possible conflicts. I have asked for an issue to be created to allow installing some additional plugins on the CJOC (including Git) so that Global Tools can set up configurations using them. Also so I can run a pipeline job that does customized backup of CJOC config. All the plugins that contribute content to the Global Tools config should be allowed on the CJOC. I haven't checked that the issue was created though.

Please sign in to leave a comment.