我之前使用Ruby on Rails
作为开发环境在Vagrant
中开展了一个项目。完成项目后,我开始在Java
的项目中工作,但是当我尝试将项目克隆到我的工作区时,我在Git Bash控制台上收到此错误:
git clone git@git.address.com:mari/project.git
Cloning into 'project'
/usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:763:in 'initialize': No route to host - connect(2) (Errno::EHOSUNREACH)
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:763:in 'open'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:763:in 'block in connect'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:55:in 'timeout'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:100:in 'timeout'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:763:in 'connect'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:756:in 'do_start'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:745:in 'start'
from /opt/git/gitlab-shell/lib/gitlab_net.rb:56:in 'get'
from /opt/git/gitlab-shell/lib/gitlab_net.rb:17:in 'allowed?'
from /opt/git/gitlab-shell/lib/gitlab_net.rb:51:in 'validate_access'
from /opt/git/gitlab-shell/lib/gitlab_net.rb:21:in 'exec'
from /opt/git/gitlab-shell/lib/gitlab_net.rb:16:in '<main>'
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
注意:我已尝试过此解决方案(Change the URI (URL) for a remote Git repository)并且无效。知道可能会发生什么吗?
编辑:我正在使用Windows,但Vagrant上使用的VM是Linux。
答案 0 :(得分:1)
尝试将协议添加到远程网址的开头:
ssh://git@git.address.com/mari/project.git
也不要使用:
分隔路径和uri,而是使用/
代替。
当然,您可以使用其他协议作为ssh。
答案 1 :(得分:1)
像这样尝试git remote url
http://<username>@git.address.com/<path>.git