Clone and pull fail on Windows if the name of files in the repository contains backslashes
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
問題
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
Diagnostic Steps
- When running
git clone
orgit pull
the operation fails with anNo 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
原因
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
を実行します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.