Import project from repository by URL
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
You can import your existing repositories by providing the Git URL. You can’t import GitLab issues and merge requests this way. Other methods provide more complete import methods.
If the repository is too large, the import might time out.
You can import your Git repository by:
Prerequisites
- Repository by URL import source must be enabled. If not enabled, ask your GitLab administrator to enable it. The Repository by URL import source is enabled by default on GitLab.com.
- At least the Maintainer role on the destination group to import to.
- If importing a private repository, an access token for authenticated access to the source repository might be required instead of a password.
Import a project by using the UI
- On the left sidebar, at the top, select Create new ( ) and New project/repository.
- Select Import project.
- Select Repository by URL.
- Enter a Git repository URL.
- Complete the remaining fields. A username and password (or access token) is required for imports from private repositories.
- Select Create project.
Your newly created project is displayed.
Import a timed-out project
Imports of large repositories might time out after three hours. To import a timed-out project:
Clone the repository.
git clone --mirror https://example.com/group/project.git
The
--mirror
option ensures all branches, tags, and refs are copied.Add the new remote repository.
cd repository.git git remote add new-origin https://gitlab.com/group/project.git
Push everything to the new remote repository.
git push --mirror new-origin
Import a project by using the API
You can use the Projects API to import a Git repository:
curl --location "https://gitlab.example.com/api/v4/projects/" \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-token>' \
--data-raw '{
"description": "New project description",
"path": "new_project_path",
"import_url": "https://username:password@example.com/group/project.git"
}'
Some providers do not allow a password and instead require an access token.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support