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

134 lines
5 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
type: reference, howto
stage: Manage
group: Import
2021-02-22 17:27:13 +05:30
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/#assignments
2020-06-23 00:09:42 +05:30
---
2021-09-04 01:27:46 +05:30
# Import your project from Bitbucket Server to GitLab **(FREE)**
2018-11-18 11:00:15 +05:30
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
2021-02-22 17:27:13 +05:30
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.
2021-06-08 01:23:25 +05:30
The Bitbucket importer can import:
2018-11-18 11:00:15 +05:30
2021-06-08 01:23:25 +05:30
- Repository description (GitLab 11.2+)
- Git repository data (GitLab 11.2+)
- Pull requests (GitLab 11.2+)
- Pull request comments (GitLab 11.2+)
When importing, repository public access is retained. If a repository is private in Bitbucket, it's
created as private in GitLab as well.
2018-11-18 11:00:15 +05:30
## Limitations
2021-06-08 01:23:25 +05:30
- GitLab doesn't allow comments on arbitrary lines of code, so any Bitbucket comments out of bounds
are inserted as comments in the merge request.
- Bitbucket Server allows multiple levels of threading. GitLab import collapses this into one thread
and quote part of the original comment.
- Declined pull requests have unreachable commits, which prevents the GitLab importer from
generating a proper diff. These pull requests show up as empty changes.
- Attachments in Markdown are not imported.
- Task lists are not imported.
- Emoji reactions are not imported.
2021-09-30 23:02:18 +05:30
- Project filtering does not support fuzzy search (only `starts with` or `full match strings` are
2021-06-08 01:23:25 +05:30
supported).
2018-11-18 11:00:15 +05:30
## How it works
The Bitbucket Server importer works as follows:
2021-06-08 01:23:25 +05:30
1. The user is 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.
2021-06-08 01:23:25 +05:30
1. The importer attempts to list all the current repositories on the Bitbucket Server.
1. Upon selection, the importer clones the repository and import pull requests and comments.
2018-11-18 11:00:15 +05:30
### User assignment
When issues/pull requests are being imported, the Bitbucket importer tries to
2021-09-30 23:02:18 +05:30
find the author's email address with a confirmed email 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
2021-06-08 01:23:25 +05:30
the author. The importer appends a note in the comment to mark the original
2018-11-18 11:00:15 +05:30
creator.
2021-06-08 01:23:25 +05:30
The importer creates any new namespaces (groups) if they don't exist or in
the case the namespace is taken, the repository is imported under the user's
2018-11-18 11:00:15 +05:30
namespace that started the import process.
2020-11-24 15:15:51 +05:30
#### User assignment by username
2021-01-03 14:25:43 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/218609) in GitLab 13.4.
> - It's [deployed behind a feature flag](../../feature_flags.md), disabled by default.
> - It's disabled on GitLab.com.
> - It's not recommended for production use.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to enable it.
2021-02-22 17:27:13 +05:30
WARNING:
2021-01-03 14:25:43 +05:30
This feature might not be available to you. Check the **version history** note above for details.
If you've enabled this feature, the importer tries to find a user in the GitLab user database with
the author's:
- `username`
- `slug`
- `displayName`
2021-12-11 22:18:48 +05:30
If the user is not found by any of these properties, the project creator is set as the author.
2020-11-24 15:15:51 +05:30
2021-01-03 14:25:43 +05:30
##### Enable or disable User assignment by username
User assignment by username is under development and not ready for production use. It is
deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can enable it.
To enable it:
2020-11-24 15:15:51 +05:30
```ruby
Feature.enable(:bitbucket_server_user_mapping_by_username)
2021-01-03 14:25:43 +05:30
```
2020-11-24 15:15:51 +05:30
2021-01-03 14:25:43 +05:30
To disable it:
```ruby
2020-11-24 15:15:51 +05:30
Feature.disable(:bitbucket_server_user_mapping_by_username)
```
2021-06-08 01:23:25 +05:30
## Import your Bitbucket repositories
2018-11-18 11:00:15 +05:30
2021-12-11 22:18:48 +05:30
Prerequisite:
2018-11-18 11:00:15 +05:30
2021-12-11 22:18:48 +05:30
- An administrator must have enabled the importer in
**Admin > Application Settings > Visibility and access controls > Import sources**.
2018-11-18 11:00:15 +05:30
2021-12-11 22:18:48 +05:30
To import your Bitbucket repositories:
2018-11-18 11:00:15 +05:30
2021-12-11 22:18:48 +05:30
1. Sign in to GitLab.
1. On the top bar, select **New** (**{plus}**).
1. Select **New project/repository**.
1. Select **Import project**.
1. Select **Bitbucket Server**.
1. Log in to Bitbucket and grant GitLab access to your Bitbucket account.
1. Select the projects that you'd like to import or import all projects.
You can filter projects by name and select the namespace
each project will be imported for.
2018-11-18 11:00:15 +05:30
2021-12-11 22:18:48 +05:30
## Automate group and project import **(PREMIUM)**
2018-11-18 11:00:15 +05:30
2021-12-11 22:18:48 +05:30
For information on automating user, group, and project import API calls, see
[Automate group and project import](index.md#automate-group-and-project-import).
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.
2021-11-18 22:05:49 +05:30
- Set up [Repository Mirroring](../repository/mirror/index.md), which provides verbose error output.
2020-11-24 15:15:51 +05:30
2020-05-24 23:13:21 +05:30
See the [troubleshooting](bitbucket.md#troubleshooting) section for [Bitbucket](bitbucket.md).