summaryrefslogtreecommitdiff
path: root/doc/raketasks/import.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/raketasks/import.md')
-rw-r--r--doc/raketasks/import.md24
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