Resolve error message "Command failed. Return value: 128" for a failed repository import in Bitbucket Cloud
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
This article covers how to resolve a failed repository import with the error "Your import has failed. For more information, check the log below. You can also try your import again."
Diagnosis
The following is outputted:
15:10:07 git import for: https://bitbucket.org/workspace_id/repo_name/src/master/
15:10:07 Cloning https://bitbucket.org/workspace_id/repo_name/src/master/...
15:10:08 Remote Git clone failed: <class 'bitbucket.apps.asyncx.tasks.RepoImportTask.ImportException'>: Command failed. Return value: 128
Cause
This error is most likely caused by incorrect credentials being provided in the authorization details on the import page.
Solution
To import a private repository, you must provide authorization details in the Import page.
1. On the Import repository page, add the repo URL you want to import in the URL field under Old repository.
2. If you are cloning a private repo, select the checkbox Requires authorization (this is not necessary if you import a public repo).
3. You will see two new fields, Username and Password.
Importing a repo from GitHub and GitLab
GitHub and GitLab require a personal access token for authentication. Be sure you are using the proper credentials you'd use to clone the repository on Github/Gitlab.
Importing a repo from Bitbucket Cloud
In the Username field, you will need to enter either your Bitbucket account's username, which you can find here: https://bitbucket.org/account/settings/, or the static username
x-bitbucket-api-token-auth
. In the Password field, you will need to enter an API token for your Bitbucket account that has at least the scope read:repository:bitbucket. Your account's password will not work, because we have deprecated the use of account passwords for Git over HTTPS and API.
4. Under New repository, select a Project and a Repository name for the imported repo.
5. Adjust the Access level field, depending on whether you want the imported repo to be private or public.
6. Expand the option Advanced settings and adjust these settings as needed.
7. Select Import repository.
Example log snippet of a successful import:
We're getting things warm and cozy for your code.
git import for: https://bitbucket.org/workspace/repo-slug/
Cloning https://bitbucket.org/workspace/repo-slug/...
Done
Fixing repository permissions...
Computing repository size...
Remote Git clone OK
When you attempt to import a repository and give it a name that is already used by another repo in the workspace, an error message will be displayed saying, "You already have a repository with this name." As a result, the password entered and the project selected will be reset. Please ensure that you select the project again and also enter the API token in the Password field before attempting to import again with a new name.
Was this helpful?