Unable to clone Bitbucket Server repository on Windows OS due to invalid path error
プラットフォームについて: サーバーと Data Center のみ。この記事は、サーバーおよび Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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'.
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.
- 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
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.