debian-mirror-gitlab/doc/user/project/import/bitbucket_server.md

116 lines
4.8 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
type: reference, howto
stage: Manage
group: Import
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
2018-11-18 11:00:15 +05:30
# Import your project from Bitbucket Server to GitLab
2020-04-22 19:07:51 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/20164) in GitLab 11.2.
2018-11-18 11:00:15 +05:30
NOTE: **Note:**
2019-12-21 20:55:43 +05:30
The Bitbucket Server importer does not work with [Bitbucket Cloud](https://bitbucket.org).
2018-11-18 11:00:15 +05:30
Use the [Bitbucket Cloud importer](bitbucket.md) for that.
Import your projects from Bitbucket Server to GitLab with minimal effort.
## Overview
- In its current state, the Bitbucket importer can import:
- the repository description (GitLab 11.2+)
- the Git repository data (GitLab 11.2+)
- the pull requests (GitLab 11.2+)
- the pull request comments (GitLab 11.2+)
- Repository public access is retained. If a repository is private in Bitbucket
it will be created as private in GitLab as well.
## Limitations
1. Currently GitLab doesn't allow comments on arbitrary lines of code, so any
2019-07-07 11:18:12 +05:30
Bitbucket comments out of bounds will be inserted as comments in the merge
request.
2019-09-30 21:07:59 +05:30
1. Bitbucket Server allows multiple levels of threading. GitLab import
will collapse this into one thread and quote part of the original comment.
2019-02-15 15:39:39 +05:30
1. Declined pull requests have unreachable commits, which prevents the GitLab
2019-07-07 11:18:12 +05:30
importer from generating a proper diff. These pull requests will show up as
empty changes.
2018-11-18 11:00:15 +05:30
1. Attachments in Markdown are currently not imported.
1. Task lists are not imported.
2020-11-24 15:15:51 +05:30
1. Emoji reactions are not imported.
1. [LFS objects](../../../topics/git/lfs/index.md) are not imported.
NOTE: **Note:**
To import a repository including LFS objects from a Bitbucket server repository, use the [Repo by URL](../import/repo_by_url.md) importer.
2019-10-12 21:52:04 +05:30
1. Project filtering does not support fuzzy search (only `starts with` or `full
match strings` are currently supported)
2018-11-18 11:00:15 +05:30
## How it works
The Bitbucket Server importer works as follows:
2020-04-08 14:13:33 +05:30
1. The user will be prompted to enter the URL, username, and password (or personal access token) to log in to Bitbucket.
2018-11-18 11:00:15 +05:30
These credentials are preserved only as long as the importer is running.
1. The importer will attempt to list all the current repositories on the Bitbucket Server.
1. Upon selection, the importer will clone the repository and import pull requests and comments.
### User assignment
When issues/pull requests are being imported, the Bitbucket importer tries to
find the author's e-mail address with a confirmed e-mail address in the GitLab
2020-03-13 15:44:24 +05:30
user database. If no such user is available, the project creator is set as
2018-11-18 11:00:15 +05:30
the author. The importer will append a note in the comment to mark the original
creator.
The importer will create any new namespaces (groups) if they don't exist or in
the case the namespace is taken, the repository will be imported under the user's
namespace that started the import process.
2020-11-24 15:15:51 +05:30
#### User assignment by username
Alternatively, user assignment by username is available behind a `bitbucket_server_user_mapping_by_username` feature flag.
The importer will try to find a user in the GitLab user database using author's `username` or `slug` or `displayName`.
Falls back to author's `email` if user is not found by username.
Similarly to user assignment by email, if no such user is available, the project creator is set as the author.
To enable or disable user assignment by username:
Start a [Rails console](../../../administration/troubleshooting/debug.md#starting-a-rails-console-session).
```ruby
# Enable
Feature.enable(:bitbucket_server_user_mapping_by_username)
# Disable
Feature.disable(:bitbucket_server_user_mapping_by_username)
```
2018-11-18 11:00:15 +05:30
## Importing your Bitbucket repositories
1. Sign in to GitLab and go to your dashboard.
1. Click on **New project**.
1. Click on the "Bitbucket Server" button. If the button is not present, enable the importer in
2019-10-12 21:52:04 +05:30
**Admin > Application Settings > Visibility and access controls > Import sources**.
2018-11-18 11:00:15 +05:30
2019-10-12 21:52:04 +05:30
![Bitbucket](img/import_projects_from_new_project_page.png)
2018-11-18 11:00:15 +05:30
1. Enter your Bitbucket Server credentials.
2019-10-12 21:52:04 +05:30
![Grant access](img/bitbucket_server_import_credentials.png)
2018-11-18 11:00:15 +05:30
1. Click on the projects that you'd like to import or **Import all projects**.
2019-10-12 21:52:04 +05:30
You can also filter projects by name and select the namespace under which each project will be
2018-11-18 11:00:15 +05:30
imported.
2019-10-12 21:52:04 +05:30
![Import projects](img/bitbucket_server_import_select_project_v12_3.png)
2020-05-24 23:13:21 +05:30
## Troubleshooting
2020-11-24 15:15:51 +05:30
If the GUI-based import tool does not work, you can try to:
- Use the [GitLab Import API](../../../api/import.md#import-repository-from-bitbucket-server) Bitbucket server endpoint.
- Set up [Repository Mirroring](../repository/repository_mirroring.md), which provides verbose error output.
2020-05-24 23:13:21 +05:30
See the [troubleshooting](bitbucket.md#troubleshooting) section for [Bitbucket](bitbucket.md).