git clone is failing with "Clone succeeded, but checkout failed" error in Bitbucket Data Center

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

When attempting to perform a git clone, the output displays the message "Clone succeeded, but checkout failed" and the user does not see any data within the cloned repository directory on the client machine.

1 2 3 4 5 6 remote: Total 330323 (delta 222507), reused 330323 (delta 222507), pack-reused 0 Receiving objects: 100% (330323/330323), 13.51 GiB | 31.28 MiB/s, done. Resolving deltas: 100% (222507/222507), done. fatal: cannot create directory at 'Repo_1/Release_1.10/Myfolder/XYZ /v01': No such file or directory warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status'

Environment

Tested on Bitbucket Data Center 7.21.10 and also applicable to other versions of Bitbucket Data Center.

Diagnosis

A. Review the file path mentioned in the error for any unusual characters or spaces.

B. Collect git debug output from client machine where git clone is failing:

1 2 3 4 5 6 7 8 9 10 11 If the git client is on a Linux machine and if the git client is on Windows Bash: export GIT_TRACE_PACKET=1 export GIT_TRACE=1 export GIT_CURL_VERBOSE=1 If the git client is on a Windows machine: set GIT_TRACE_PACKET=1 set GIT_TRACE=1 set GIT_CURL_VERBOSE=1

Cause

This issue generally occurs when git clone is performed on Windows client machine and there is a unusual characters or spaces present in the file path or directory path.

Solution

There is no direct approach of resolving the issue as we need Linux Server to fix this issue instead of Windows machine. To resolve this issue, user need to follow below steps:

Step1:

  • User need to clone the problematic repository on the Linux server first.

  • Once it is done, rename the problematic directory using the mv <correct_directory_name> command and confirmed the changes with the ls -ltr command.

    Note: Please validate if Branch need to be changed using git checkout <branch> command before doing it if you have multiple branches.

  • Once the directory has been renamed, run the following git commands:

    A. git add .

    B. git commit -m "commit message"

    C. git push

Step2:

  • With the above steps, issue should get resolved and the user should see the correct directory with the improved name in Bitbucket UI. But in case, if user also found both the problematic directory in Bitbucket UI and improved directory, then user need to follow below steps further:

    A. git clone <same_repository> on Linux Machine

    B. rm -rf <problematic directory> (shift the required branch first using git checkout <branch> command if required first)

    C. git add .

    D. git commit -m <commit message>

    E. git push

    Now the issue should get resolved in Bitbucket UI as well as for the Windows client.

Updated on April 11, 2025

Still need help?

The Atlassian Community is here for you.