Clone and pull fail on Windows if the name of files in the repository contains backslashes
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
It is possible for a user on Linux, UNIX or MacOS X to create and commit a file to a repository whose name contains a backslash. If a user on a Windows machine tries to clone or pull from that repository, the operation will fail with an error stating
No such file or directory. This error also occurs when using SourceTree.
- A Windows-based git client (either git on the command line or via SourceTree) is used to clone or pull from a repository
- When running
git pullthe operation fails with an
No such a file or directoryerror being displayed.
- The repository that is being cloned contains a file whose name contains a backslash, e.g.
Backslashes are special characters on Windows operating systems since they are used to separate paths (e.g.
C:\Windows\System32). They are therefore considered invalid characters for filenames on Windows.
To resolve the problem, the file whose name contains a backslash needs to be removed from the repository. Follow these steps to remove the file from the repository.
- Clone the repository using a Linux, UNIX or MacOS X machine
- Delete the offending file (or rename it so its name no longer contains a backslash)
git add --all
You should now see from the Bitbucket Server web interface that the file with the backslash in its name is gone (or has been renamed). The clone or pull operation should now succeed on Windows clients.