Sunday, 22 March 2015

Git Checkout and Long Filenames

This is just a short note that could be helpful in doing a 'git' checkout of projects/files having longer than usual names. A couple of days back, had to check out a 'git' project owned and managed by another team. The project was pretty big so the 'git' clone operation ran for hours but eventually ended with the following message.

"cannot create directory.....
warning: Filename too long
warning: clone succeeded but checkout failed..."


Yes, it's baffling. Yes, it's cumbersome to have that long a filename but there was nothing I could do; till I came across the following solution. Give the following command to allow long filenames using 'git' in a Windows system:

"git config --system core.longpaths true"

And then if the clone had succeeded, use the following command to complete the checkout process and one is good to go.

"git checkout -f HEAD"



5 comments:

  1. I recommend you to try Long Path Tool program to solve this problem

    ReplyDelete
  2. “Long Path Tool” is very helpful for this error !
    You can use to solve this problem

    ReplyDelete

  3. “Long Path Tool” is very helpful for this error !
    best solution for your problem.

    ReplyDelete
  4. Thanks, ppl! "Long Path Tool" it is :)

    ReplyDelete
  5. Yes! When cleaning files from a Windows Operating System (OS), you are halted with errors relating to the filename or the file "long path tool".
    It is very perfect software program

    ReplyDelete