GitException File Name Too Long


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(
  at hudson.plugins.git.GitSCM.checkout(
  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(
  at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(
  at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(
  at hudson.model.ResourceController.execute(
Caused by: hudson.plugins.git.GitException: xxxx checkout -f xxx returned status code 128:
stderr: fatal: cannot create directory at 'xxxx': Filename too long


CloudBees Jenkins Enterprise



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?


  • 0
    Utp Team

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


  • 0
    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.

  • 0
    Mark Waite

    Users of the most recent version of Windows 10 can also set a registry key that will enable long paths across the entire system (rather than just configuring core.longpaths for git).

    There is also a system-wide configuration which can be set for git by a user running as administrator.  Use the "--system" argument instead of "--global".

    Edited by Mark Waite
Please sign in to leave a comment.