Clone and pull fail on Windows if the name of files in the repository contains backslashes

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

 

Problem

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.

Diagnosis

Environment

  • A Windows-based git client (either git on the command line or via SourceTree) is used to clone or pull from a repository

Diagnostic Steps

  • When running git clone or git pull the operation fails with an No such a file or directory error being displayed.
  • The repository that is being cloned contains a file whose name contains a backslash, e.g. Some\File.txt 

Cause

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. 

Resolution

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.

  1. Clone the repository using a Linux, UNIX or MacOS X machine
  2. Delete the offending file (or rename it so its name no longer contains a backslash)
  3. Run git add --all
  4. Run git commit

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.

Last modified on Aug 2, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.