'git clone command issue with long path [duplicate]

I am using git clone command

git clone <repo_url> <moveToDirectory>.

This command is working fine if moveToDirectory length is short, But if moveToDirectory length is long (i.e a with more folders), then this command is not working.

How can I use git clone in the second case?

git


Solution 1:[1]

My problem is solved by using this solution

Filename too long in Git for Windows

git config --system core.longpaths true

The solution above did not work with git 1.17... version of git therefore I needed to upgrade my git to the latest version.

Solution 2:[2]

What you can do is using the syntax:

git -C /long/path/to/parent/folder clone <url> directoryName

That will force Git to cd into the long path first, then clone to the folder.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 D.ethereal
Solution 2 VonC