'"Illegal characters in path" while cloning with git from Visual Studio 2017

On Visual Studio 2017, I can not clone a repository with git. I'm having this error message:

enter image description here

The repository url is good and the destination folder is also fine (no spaces or special characters). I tried on another computer and everything works perfectly. When I'm cloning the same project with GitKraken, SourceTree or in command line, everything works. I tried to uninstall git, cleaning my tfs/git credentials, uncheck "Git for Windows" option on the Visual Studio installer, in vain....

Has anyone ever had the same problem? How did you solve it? Thanks for the help!

Visual Studio 2017: 15.9.11
Git version: 2.21.0
Git url path: https://tfs.mysubdomain.mydomain.fr/dev/PROJECT/_git/PROJECT
TFS Server: https://tfs.mysubdomain.mydomain.fr/dev/PROJECT/PROJECT%20Team/_git/PROJECT


Solution 1:[1]

I finally fixed it by this way:

  • uncheck the "Git for Windows" checkbox in Visual Studio Installer
  • uninstall git (for me it was version 2.21.0)
  • uninstall other git apps (for me it was GitKraken and SourceTree)
  • delete all git and tfs credentials via the credential manager
  • reboot (just in case)
  • install git
  • launch visual studio and connect to the TFS server
  • you can now clone and work peacefully

Et voilà :)

Everything works perfectly now. I think uninstall only git was not enough. I don't really understand why I had this issue but the bulldozer strategy was efficient.

Solution 2:[2]

I'm not sure what's the cause of it. I've been running git commands in the Windows Terminal. And the same problem happened when I try to pull in Visual Studio.

Here's how I got the problem resolved:

Restart the computer?

Solution 3:[3]

I've resolved this by deleting .\obj and .\bin folders in my startup project.

Solution 4:[4]

I finally fixed it by deleting index.lock in /git 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 Régis NIOX
Solution 2 Lok
Solution 3 knile
Solution 4 Adnan Hussain