Unable to clone Bitbucket Server repository on Windows OS due to invalid path error
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Summary
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'.
Environment
Bitbucket Server Windows OS
Diagnosis
Git clone returns the output as below when cloning the repository on client's Windows operating system.
1
2
3
4
5
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 :/'
Cause
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.
1
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.
Solution
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.
1
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 only affects a single file, rename the repository file path according to the Windows file naming rules.
Was this helpful?