Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 420
knowledge20 Avatar asked Oct 08 '18 09:10

knowledge20


People also ask

Can't checkout filename too long?

Go to Computer Configuration → Administrative Templates → System → Filesystem in gpedit. msc , open Enable Win32 long paths and set it to Enabled.

How do I enable long path support in Git?

windows-10-git.mdGo to Computer Configuration > Administrative Templates > System > Filesystem in gpedit. msc , open Enable Win32 long paths and set it to Enabled .

Why Git clone is not working?

If you have a problem cloning a repository, or using it once it has been created, check the following: Ensure that the user has gone through initial GitCentric login and has the correct username, email, and ssh. This should return a usage message that refers to the config-branch, config-repo, and ls-repo commands.


1 Answers

  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>

like image 59
Shayki Abramczyk Avatar answered Sep 23 '22 02:09

Shayki Abramczyk