BigW Consortium Gitlab

import.md 2.01 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 installations from source, it is usually located at: `/home/git/repositories` or you can see where
17 18
your repositories are located by looking at `config/gitlab.yml` under the `repositories => storages` entries
(you'll usually use the `default` storage path to start).
19

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

```
23
sudo -u git mkdir /var/opt/gitlab/git-data/repositories/new_group
24 25
```

26 27 28
If you are using an installation from source, replace `/var/opt/gitlab/git-data`
with `/home/git`.

Patricio Cano committed
29
### Copy your bare repositories inside this newly created folder:
30 31

```
32 33 34 35
sudo cp -r /old/git/foo.git /var/opt/gitlab/git-data/repositories/new_group/

# Do this once when you are done copying git repositories
sudo chown -R git:git /var/opt/gitlab/git-data/repositories/new_group/
36 37
```

38 39
`foo.git` needs to be owned by the git user and git users group.

40 41 42
If you are using an installation from source, replace `/var/opt/gitlab/git-data`
with `/home/git`.

43
### Run the command below depending on your type of installation:
44

45
#### Omnibus Installation
46 47 48 49

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

51
#### Installation from source
52

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

55 56 57
```
$ cd /home/git/gitlab
$ sudo -u git -H bundle exec rake gitlab:import:repos RAILS_ENV=production
58 59
```

60
#### Example output
61 62 63 64 65 66 67 68 69

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