BigW Consortium Gitlab

import.md 1.95 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
your repositories are located by looking at `config/gitlab.yml` under the `gitlab_shell => repos_path` entry.
18

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

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

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

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

```
31 32 33 34
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/
35 36
```

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

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

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

44
#### Omnibus Installation
45 46 47 48

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

50
#### Installation from source
51

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

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

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

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