Kindly help me in how to import or push a bare git repository to the GitLab. I'm kind of new to Git & GitLab , so a detailed explanation would be of great help ! I'm using CentOS and GitLab CE edition, version 7.13.1. Many Thanks for any help :)
Asked
Active
Viewed 5,707 times
1 Answers
3
If you have an existing repo you want to import to your GitLab CE server, you can follow: Import bare repositories into your GitLab instance
The repo is first copied on the server:
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/
And then you can register it (still on the GitLab server side):
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:import:repos RAILS_ENV=production
Now you can clone it one any client as usual.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
@babayaga sure: just create a project (http://doc.gitlab.com/ce/gitlab-basics/create-project.html, or https://www.digitalocean.com/community/tutorials/how-to-use-the-gitlab-user-interface-to-manage-projects#initialize-a-project) That will create a bare repo for you. – VonC Aug 01 '15 at 16:16
-
Thanks for the suggestion, apart from the import option, is there a possibility to create a bare repo directly in GitLab (web interface)?Also, my bare repo is named as 'foo' and not foo.git , will it be a problem ? I had a look at the instructions and unable to get what is the "new_group" means,a normal directory? – baba yaga Aug 01 '15 at 16:23
-
@babayaga as I mention, you create a project `newgroup/foo`. That will create the right bare repo foo.git for you on the server side. For group, see http://stackoverflow.com/a/15894795/6309. Also see http://doc.gitlab.com/ce/gitlab-basics/create-group.html. – VonC Aug 01 '15 at 16:24
-
Really appreciate your inputs, so when I create a project directly in the GitLab webinterface- http://doc.gitlab.com/ce/gitlab-basics/create-project.html , that will be a bare repository not a normal repo with working copy right ? – baba yaga Aug 01 '15 at 16:33
-
@babayaga yes, on the server side, it will create a bare repo. Once you clone it though, you will get a normal non-bare repo on the client side. – VonC Aug 01 '15 at 16:33