import.md 1.6 KB
Newer Older
1
# Import bare repositories into your GitLab instance
2

3
## Notes
4

5 6 7 8
- The owner of the project will be the first admin
- The groups will be created as needed
- The owner of the group will be the first admin
- Existing projects will be skipped
9

10
## How to use
11

12
### Create a new folder inside the git repositories path. This will be the name of the new group.
13

14 15
- For omnibus-gitlab, it is located at: `/var/opt/gitlab/git-data/repositories` by default, unless you changed
it in the `/etc/gitlab/gitlab.rb` file.
16
- For manual installations, it is usually located at: `/home/git/repositories` or you can see where
17
your repositories are located by looking at `config/gitlab.yml` under the `gitlab_shell => repos_path` entry.
18

19 20 21 22 23 24 25 26
New folder needs to have git user ownership and read/write/execute access for git user and its group:

```
$ mkdir new_group
$ chown git:git new_group
$ chmod 770 new_group
```

Patricio Cano's avatar
Patricio Cano committed
27
### Copy your bare repositories inside this newly created folder:
28 29

```
30
$ cp -r /old/git/foo.git/ /home/git/repositories/new_group/
31 32
```

33 34
`foo.git` needs to be owned by the git user and git users group.

35
### Run the command below depending on your type of installation:
36

37
#### Omnibus Installation
38 39 40 41

```
$ sudo gitlab-rake gitlab:import:repos
```
42

43
#### Manual Installation
44

45
Before running this command you need to change the directory to where your GitLab installation is located:
46

47 48 49
```
$ cd /home/git/gitlab
$ sudo -u git -H bundle exec rake gitlab:import:repos RAILS_ENV=production
50 51
```

52
#### Example output
53 54 55 56 57 58 59 60 61

```
Processing abcd.git
 * Created abcd (abcd.git)
Processing group/xyz.git
 * Created Group group (2)
 * Created xyz (group/xyz.git)
[...]
```