diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /doc/raketasks/import.md | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'doc/raketasks/import.md')
-rw-r--r-- | doc/raketasks/import.md | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/doc/raketasks/import.md b/doc/raketasks/import.md index 263f9e54a20..c8ca92b4bae 100644 --- a/doc/raketasks/import.md +++ b/doc/raketasks/import.md @@ -1,6 +1,9 @@ # Import bare repositories **(CORE ONLY)** Rake tasks are available to import bare repositories into a GitLab instance. +When migrating from an existing GitLab instance, +and to preserve ownership by users and their namespaces, +please use [our project-based import/export](../user/project/settings/import_export.md). Note that: @@ -14,11 +17,14 @@ Note that: To import bare repositories into a GitLab instance: -1. Create a new folder to import your Git repositories from. The new folder needs to have Git user - ownership and read/write/execute access for Git user and its group: +1. Create a new folder to import your Git repositories from. + You can also import projects into a (sub)group's namespace, + instead of the administrator's namespace. To do so, create subfolders and + give ownership and read/write/execute permissions of those subfolders to the + `git` user and its group: ```shell - sudo -u git mkdir -p /var/opt/gitlab/git-data/repository-import-<date>/new_group + sudo -u git mkdir -p /var/opt/gitlab/git-data/repository-import-$(date "+%Y-%m-%d")/<optional_groupname>/<optional_subgroup> ``` 1. Copy your bare repositories inside this newly created folder. Note: @@ -26,15 +32,15 @@ To import bare repositories into a GitLab instance: - Any `.git` repositories found on any of the subfolders will be imported as projects. - Groups will be created as needed, these could be nested folders. - For example, if we copy the repositories to `/var/opt/gitlab/git-data/repository-import-<date>`, + For example, if we copy the repositories to `/var/opt/gitlab/git-data/repository-import-2020-08-22`, and repository `A` needs to be under the groups `G1` and `G2`, it must be created under those folders: - `/var/opt/gitlab/git-data/repository-import-<date>/G1/G2/A.git`. + `/var/opt/gitlab/git-data/repository-import-2020-08-22/G1/G2/A.git`. ```shell - sudo cp -r /old/git/foo.git /var/opt/gitlab/git-data/repository-import-<date>/new_group/ + sudo cp -r /old/git/foo.git /var/opt/gitlab/git-data/repository-import-$(date "+%Y-%m-%d")/<optional_groupname>/<optional_subgroup> # Do this once when you are done copying git repositories - sudo chown -R git:git /var/opt/gitlab/git-data/repository-import-<date> + sudo chown -R git:git /var/opt/gitlab/git-data/repository-import-$(date "+%Y-%m-%d") ``` `foo.git` needs to be owned by the `git` user and `git` users group. @@ -46,7 +52,7 @@ To import bare repositories into a GitLab instance: - Omnibus Installation ```shell - sudo gitlab-rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import-<date>'] + sudo gitlab-rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import-$(date "+%Y-%m-%d")'] ``` - Installation from source. Before running this command you need to change to the directory where @@ -54,7 +60,7 @@ To import bare repositories into a GitLab instance: ```shell cd /home/git/gitlab - sudo -u git -H bundle exec rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import-<date>'] RAILS_ENV=production + sudo -u git -H bundle exec rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import-$(date "+%Y-%m-%d")'] RAILS_ENV=production ``` ## Example output |