GitException File Name Too Long

Issue

Git exception: Filename too long during checkout

A git checkout fails with an exception similar to:

```
Checking out Revision xxx

hudson.plugins.git.GitException: Could not checkout xxx
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2005)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1124)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:109)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)
at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:85)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:207)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: xxxx checkout -f xxx returned status code 128:
stdout:
stderr: fatal: cannot create directory at ‘xxxx’: Filename too long
```

Environment

CloudBees Jenkins Enterprise

Jenkins

Resolution

In order for Git to handle long filenames correctly, core.longpaths=true needs to be enabled.

To set this argument you can do the following:

git config --global core.longpaths true

Have more questions? Submit a request

4 Comments

  • 0
    Avatar
    Luisa L

    Long Path Tool can help you to remove blocked files or too long path files. You can easily fix file errors with this software.

  • 0
    Avatar
    Frank Jackson

    search google for Long Path Tool and it will resolve all of your problems

  • 0
    Avatar
    Utp Team

    Where should the above setting be configured? Which location does git plugin from Jenkins read to get the config settings ?

     

  • 0
    Avatar
    Denys Digtiar

    Hi Utp Team,

    By default, Git Plugin uses the native git CLI. Therefore, if you run the command on the Agent using the same git as Jenkins configure to use, it will be written in a right config file and should be picked up from Jenkins.

Please sign in to leave a comment.