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

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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.

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.

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

  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.



Last modified on Sep 3, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.