git pull aborted with error filename too long

前端 未结 7 1221
有刺的猬
有刺的猬 2020-12-07 08:11

I\'m using Windows as my OS, and working on a project with a friend who\'s using a Mac. He checked in code to our Github.

I was trying to git pull everything he did

相关标签:
7条回答
  • 2020-12-07 08:45

    Open your.gitconfig file to add the longpaths property. So it will look like the following:

    [core]
    symlinks = false
    autocrlf = true
    longpaths = true
    
    0 讨论(0)
  • 2020-12-07 08:46

    A few years late, but I'd like to add that if you need to do this in one fell swoop (like I did) you can set the config settings during the clone command. Try this:

    git clone -c core.longpaths=true <your.url.here>
    
    0 讨论(0)
  • 2020-12-07 08:51

    On windows run "cmd " as administrator and execute command.

    "C:\Program Files\Git\mingw64\etc>"
    "git config --system core.longpaths true"
    

    or you have to chmod for the folder whereever git is installed.

    or manullay update your file manually by going to path "Git\mingw64\etc"

    [http]
        sslBackend = schannel
    [diff "astextplain"]
        textconv = astextplain
    [filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true
    [credential]
        helper = manager
    **[core]
        longpaths = true**
    
    0 讨论(0)
  • 2020-12-07 08:52

    The msysgit FAQ on Git cannot create a filedirectory with a long path doesn't seem up to date, as it still links to old msysgit ticket #110. However, according to later ticket #122 the problem has been fixed in msysgit 1.9, thus:

    1. Update to msysgit 1.9 (or later)
    2. Launch Git Bash
    3. Go to your Git repository which 'suffers' of long paths issue
    4. Enable long paths support with git config core.longpaths true

    So far, it's worked for me very well.

    Be aware of important notice in comment on the ticket #122

    don't come back here and complain that it breaks Windows Explorer, cmd.exe, bash or whatever tools you're using.

    0 讨论(0)
  • 2020-12-07 09:00

    Try to keep your files closer to the file system root. More details : for technical reasons, Git for Windows cannot create files or directories when the absolute path is longer than 260 characters.

    0 讨论(0)
  • 2020-12-07 09:01

    As someone that has ran into this problem constantly with java repositories on Windows, the best solution is to install Cygwin (https://www.cygwin.com/) and use its git installation under all > devel > git.

    The reason this is the best solution I have come across is since Cygwin manages the long path names so other provided commands benefit. Ex: find, cp and rm. Trust me, the real problem begins when you have to delete path names that are too long in Windows.

    0 讨论(0)
提交回复
热议问题