javawindowsgitgithubgitlab

How to fix "Filename too long error" during git clone


I am trying to take a git clone from a particular branch of my bitbucket repository using the below command: git clone <url> --branch <branchname>.

However, I am getting the below error while taking the clone:

error:unable to create file foldername/nodemodules/......: Filename too long.

I tried resolving this by running the below command in my git cmd git config --system core.longpaths true.

But I am getting:

error: could not lock config file c://.gitconfig: Permission denied error: could not lock config file c://.gitconfig: Invalid argument.

How do I solve these two errors?


Solution

    1. Start Git Bash as Administrator
    2. Run command git config --system core.longpaths true

    Another way (only for this clone):

    git clone -c core.longpaths=true <repo-url>