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

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server と Data Center のみ - この記事は、サーバーおよびデータセンター プラットフォームのアトラシアン製品にのみ適用されます。

 

問題

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 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 

原因

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.

  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.

最終更新日 2016 年 8 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.