简体   繁体   中英

GIT Issue on Windows (The filename or extension is too long)

Overview:

Just installed the GIT version 2.20.1-64-bit on my Windows 7 platform. Git works well on GIT Bash; but, any git command on Windows CMD or Powershell raises The filename or extension is too long error.

Details:

  • GIT version: 2.20.1-64-bit
  • Platform: Windows 7

Troubleshooting Efforts:

I tried switching longpaths attribute to true based on Filename too long in Git for Windows . I also googled to find other solutions but all recommended the same approach which was updating the git config.

  • The GIT config file updated with git config --system core.longpaths true 在此输入图像描述

Issue:

Any Git command via Windows CMD or 3rd party apps like IntelliJ Idea raises the following error:

  • CMD: 在此输入图像描述

  • IntelliJ: 在此输入图像描述

Please advise me with your genuine solutions.

I had the same problem. I then installed it in my user folder and now it works. It seems to be a privilege issue. Git gets installed as admin in C:\\Program Files\\Git but then can't write to these files because it is run as a user.

Also using the portable version should fix the problem.

Try first to use a simplified PATH and a portable Git (like PortableGit-2.20.1-64-bit.7z.exe ) uncompressed anywhere you want.

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

Then check if the issue persists in that CMD session, where you have set said simplified PATH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM