git checkout error: unable to create file

后端 未结 5 659
清歌不尽
清歌不尽 2020-12-09 09:32

While cloning a git repository from Linux to a Windows system, I am getting the following error in checkout the phase:

$ git clone gituser@serveraddr:

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 10:01

    Try:

    git config --system core.longpaths true
    

    This will allow it to checkout the files even with longer filepaths. The issue with this would be when you try to delete it, as Windows will not allow to delete a path longer than it's allowed threshold. The workaround to that is to rename the folders in the local repository, so that the overall length of the path is lessened. For example, a path that is alpha/beta/gamma/universe.txt, can be limited to 1/2/3/universe.txt, so that it's length is under the windows filesize threshold.

提交回复
热议问题