Unable to clone Bitbucket Server repository on Windows OS due to invalid path error

お困りですか?

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

コミュニティに質問


プラットフォームについて: 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 は除く

要約

While cloning the repository using a Windows operating system, the Git output shows an error occurred regarding 'invalid path, invalid path url, unable to checkout working tree and clone succeeded but checkout failed'.

環境

Bitbucket Server
Windows OS

診断

Git clone returns the output as below when cloning the repository on client's Windows operating system.

error: invalid path 'src/staticresources/Project__AngularJS/__MACOSX/docs/partials/api/._ng.directive:a.html'
 fatal: unable to checkout working tree
 warning: Clone succeeded, but checkout failed.
 You can inspect what was checked out with 'git status
 and retry with 'git restore --source=HEAD :/'



原因

While performing git clone from the client Windows operating system, the repository path in Bitbucket server contains characters that did not adhere to the Windows file naming rules as client system is using Windows operating system.

Client's console output of git clone shows that it is unable to checkout the file as git would be unable to create such a file on client's Windows operating system.

error: invalid path 'src/staticresources/Project__AngularJS/__MACOSX/docs/partials/api/._ng.directive:a.html'


For example: In the error output above, the invalid file path ng.directive:a.html contains a colon character which is a reserved character in Windows. 

ソリューション

  1. If it involves multiple files and changing the file names could break the code, consider adding the git config parameter by setting the core.protectNTFS to false at the client's system git configuration to escape the bad file name in Windows.
git config --global core.protectNTFS false

core.protectNTFS

If set to true, do not allow checkout of paths that would cause problems with the NTFS filesystem, e.g. conflict with 8.3 "short" names. Defaults to true on Windows, and false elsewhere.


2. If it is only affecting a single file, rename the repository file path in that adhere to the Windows file naming rules.



最終更新日 2021 年 9 月 3 日

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

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