Importing git project via ssh

We have a CentOS server which is hosting both our git repository and GitLab. I am trying to import the local repository into a GitLab project but it is getting stuck during import and just keeps refreshing the screen. It appears to be an authentication issue.

From my local PC I am able to import via the following command.

git clone ssh://myuser@hostname/gitrepo/mirror/my-project.git

Which will then prompt me for my password and correctly download the content.

In the GitLab import screen I have tried the following URLs:

ssh://myuser@hostname/gitrepo/mirror/my-project.git
ssh://myuser:myPassword@hostname/gitrepo/mirror/my-project.git
ssh://myuser@IP_ADDRESS/gitrepo/mirror/my-project.git
ssh://myuser:myPassword@IP_ADDRESS/gitrepo/mirror/my-project.git
ssh://myuser@localhost/gitrepo/mirror/my-project.git
ssh://myuser:myPassword@localhost/gitrepo/mirror/my-project.git
file:///gitrepo/mirror/my-project.git

None of these work.

Cloning via:

git clone https://myuser:myPassword@hostname/gitrepo/mirror/my-project.git

or

git clone http://myuser:myPassword@hostname/gitrepo/mirror/my-project.git

does not work even on my local machine and we normally only use the ssh approach.

How can I get this working?

Maybe start with investigating the log files?

/var/log/gitlab/…

Couldn’t find anything

grep -r "git clone" /var/log/gitlab/
grep -r "my-project" /var/log/gitlab/

I also went through and used vi on the “current” log files must most of them were blank and the ones with content had nothing of interest.

grep -r “ERROR” ./

./sidekiq/current:2015-07-13_23:24:32.97773 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: Error fetching message: No such file or directory - connect(2) for /var/opt/gitlab/redis/redis.socket
./sidekiq/current:2015-07-13_23:24:32.97774 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/connection/ruby.rb:180:in `connect_nonblock'
./sidekiq/current:2015-07-13_23:24:32.97775 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/connection/ruby.rb:180:in `connect'
./sidekiq/current:2015-07-13_23:24:32.97777 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/connection/ruby.rb:209:in `connect'
./sidekiq/current:2015-07-13_23:24:32.97777 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:304:in `establish_connection'
./sidekiq/current:2015-07-13_23:24:32.97779 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:85:in `block in connect'
./sidekiq/current:2015-07-13_23:24:32.97780 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:266:in `with_reconnect'
./sidekiq/current:2015-07-13_23:24:32.97782 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:84:in `connect'
./sidekiq/current:2015-07-13_23:24:32.97783 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:326:in `ensure_connected'
./sidekiq/current:2015-07-13_23:24:32.97784 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:197:in `block in process'
./sidekiq/current:2015-07-13_23:24:32.97785 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:279:in `logging'
./sidekiq/current:2015-07-13_23:24:32.97786 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:196:in `process'
./sidekiq/current:2015-07-13_23:24:32.97788 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:102:in `call'
./sidekiq/current:2015-07-13_23:24:32.97789 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:185:in `block in call_with_timeout'
./sidekiq/current:2015-07-13_23:24:32.97790 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:253:in `with_socket_timeout'
./sidekiq/current:2015-07-13_23:24:32.97791 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:184:in `call_with_timeout'
./sidekiq/current:2015-07-13_23:24:32.97792 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:1059:in `block in _bpop'
./sidekiq/current:2015-07-13_23:24:32.97793 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `block in synchronize'
./sidekiq/current:2015-07-13_23:24:32.97795 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
./sidekiq/current:2015-07-13_23:24:32.97796 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `synchronize'
./sidekiq/current:2015-07-13_23:24:32.97797 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:1056:in `_bpop'
./sidekiq/current:2015-07-13_23:24:32.97798 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:1101:in `brpop'
./sidekiq/current:2015-07-13_23:24:32.97799 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-namespace-1.5.1/lib/redis/namespace.rb:392:in `call_with_namespace'
./sidekiq/current:2015-07-13_23:24:32.97800 2015-07-13T23:24:32.977Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-namespace-1.5.1/lib/redis/namespace.rb:289:in `method_missing'
./sidekiq/current:2015-07-13_23:24:32.97802 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:102:in `block in retrieve_work'
./sidekiq/current:2015-07-13_23:24:32.97803 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/connection_pool-2.1.0/lib/connection_pool.rb:58:in `with'
./sidekiq/current:2015-07-13_23:24:32.97804 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq.rb:72:in `redis'
./sidekiq/current:2015-07-13_23:24:32.97805 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:102:in `retrieve_work'
./sidekiq/current:2015-07-13_23:24:32.97806 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:37:in `block in fetch'
./sidekiq/current:2015-07-13_23:24:32.97807 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/util.rb:15:in `watchdog'
./sidekiq/current:2015-07-13_23:24:32.97808 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:33:in `fetch'
./sidekiq/current:2015-07-13_23:24:32.97809 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:44:in `block (2 levels) in fetch'
./sidekiq/current:2015-07-13_23:24:32.97811 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
./sidekiq/current:2015-07-13_23:24:32.97812 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
./sidekiq/current:2015-07-13_23:24:32.97813 2015-07-13T23:24:32.978Z 21944 TID-fya9c ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
./sidekiq/current:2015-07-13_23:40:31.30951 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: Error fetching message: No such file or directory - connect(2) for /var/opt/gitlab/redis/redis.socket
./sidekiq/current:2015-07-13_23:40:31.30954 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/connection/ruby.rb:180:in `connect_nonblock'
./sidekiq/current:2015-07-13_23:40:31.30956 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/connection/ruby.rb:180:in `connect'
./sidekiq/current:2015-07-13_23:40:31.30957 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/connection/ruby.rb:209:in `connect'
./sidekiq/current:2015-07-13_23:40:31.30960 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:304:in `establish_connection'
./sidekiq/current:2015-07-13_23:40:31.30962 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:85:in `block in connect'
./sidekiq/current:2015-07-13_23:40:31.30963 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:266:in `with_reconnect'
./sidekiq/current:2015-07-13_23:40:31.30964 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:84:in `connect'
./sidekiq/current:2015-07-13_23:40:31.30966 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:326:in `ensure_connected'
./sidekiq/current:2015-07-13_23:40:31.30967 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:197:in `block in process'
./sidekiq/current:2015-07-13_23:40:31.30968 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:279:in `logging'
./sidekiq/current:2015-07-13_23:40:31.30970 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:196:in `process'
./sidekiq/current:2015-07-13_23:40:31.30971 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:102:in `call'
./sidekiq/current:2015-07-13_23:40:31.30972 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:185:in `block in call_with_timeout'
./sidekiq/current:2015-07-13_23:40:31.30974 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:253:in `with_socket_timeout'
./sidekiq/current:2015-07-13_23:40:31.30975 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis/client.rb:184:in `call_with_timeout'
./sidekiq/current:2015-07-13_23:40:31.30977 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:1059:in `block in _bpop'
./sidekiq/current:2015-07-13_23:40:31.30978 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `block in synchronize'
./sidekiq/current:2015-07-13_23:40:31.30980 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
./sidekiq/current:2015-07-13_23:40:31.30982 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:37:in `synchronize'
./sidekiq/current:2015-07-13_23:40:31.30983 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:1056:in `_bpop'
./sidekiq/current:2015-07-13_23:40:31.30985 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-3.1.0/lib/redis.rb:1101:in `brpop'
./sidekiq/current:2015-07-13_23:40:31.30987 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-namespace-1.5.1/lib/redis/namespace.rb:392:in `call_with_namespace'
./sidekiq/current:2015-07-13_23:40:31.30988 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/redis-namespace-1.5.1/lib/redis/namespace.rb:289:in `method_missing'
./sidekiq/current:2015-07-13_23:40:31.30990 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:102:in `block in retrieve_work'
./sidekiq/current:2015-07-13_23:40:31.30992 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/connection_pool-2.1.0/lib/connection_pool.rb:58:in `with'
./sidekiq/current:2015-07-13_23:40:31.30993 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq.rb:72:in `redis'
./sidekiq/current:2015-07-13_23:40:31.30995 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:102:in `retrieve_work'
./sidekiq/current:2015-07-13_23:40:31.30997 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:37:in `block in fetch'
./sidekiq/current:2015-07-13_23:40:31.30998 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/util.rb:15:in `watchdog'
./sidekiq/current:2015-07-13_23:40:31.31000 2015-07-13T23:40:31.309Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:33:in `fetch'
./sidekiq/current:2015-07-13_23:40:31.31001 2015-07-13T23:40:31.310Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/sidekiq-3.3.0/lib/sidekiq/fetch.rb:44:in `block (2 levels) in fetch'
./sidekiq/current:2015-07-13_23:40:31.31003 2015-07-13T23:40:31.310Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
./sidekiq/current:2015-07-13_23:40:31.31005 2015-07-13T23:40:31.310Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
./sidekiq/current:2015-07-13_23:40:31.31006 2015-07-13T23:40:31.310Z 24105 TID-d5fck ERROR: /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'

Ok still strange. Maybe the following work-around will work?
Add gitlab remote to your existing project:

git remote add gitlab url-to-gitlab-repo
git push gitlab master

@danger89

This worked and the project is now imported.

Insted of importing, I created a “bare” repository in gitlab and used the “git remote” command on the original repo as you suggested. I have a question though. How will the GitLab repo keep up to date with the original one? What if more branches are added to the original? I want the GitLab repo to stay up to date with the original at all times.

There is no such functionality built in GitLab. You’ll have to manually do this or set up a hook I guess.

As for why your repo was not being imported, note that there is a message that says:

The repository must be accessible over HTTP(S).

From your urls you posted it seems that you only support ssh.

Importing directly from the server is possible following these instructions http://doc.gitlab.com/ce/raketasks/import.html

set up A HOOK