【问题标题】:Private Git server is invisible or unreachable私有 Git 服务器不可见或无法访问
【发布时间】:2017-09-23 14:24:28
【问题描述】:
-
在 Ubuntu 机器上,我创建了一个 repo,如下所示
netcomo@netcomoserver:/opt/git/groupware.git$ ll
Total 12
drwxr-xr-x 3 git git 4096 April 26 16:18 ./
drwxr-xr-x 3 git git 4096 April 26 13:50 ../
drwxr-xr-x 7 git git 4096 April 26 16:18 .git/
netcomo@netcomoserver:/opt/git/groupware.git$
在我想要克隆存储库的 Windows 7 上,我遇到以下错误。
可能是什么原因? (如您所见,回购服务器是可访问的)
【问题讨论】:
标签:
windows
git
ubuntu
permissions
public-key
【解决方案1】:
看起来你的 git 服务器是可以访问的。
您正在使用 SSH 访问 GIT 存储库。在这种情况下,您需要创建一个 SSH 密钥。
如果这样做,请存储您的公钥
.ssh/authorized_keys
在你的 Ubuntu 机器上。
在 Windows 上,您可以使用 Putty http://www.putty.org/ 创建 SSH 密钥
【解决方案2】:
我应该检查以下几点:
-
要使用“ssh-copy-id”命令将公钥从客户端计算机复制到服务器(示例如下所示),我需要在服务器计算机上将 sshd_config 文件的选项更改为“yes”。
命令:
$ ssh-copy-id ~/.ssh/id_rsa netcomo@netcomoserver
$ sudo vi /etc/ssh/sshd_config
密码验证是
将公钥复制到服务器后,上面改的'yes'需要改回'no'
-
供您参考,如果您需要访问多个服务器帐户,您必须为每个不同的帐户复制相同的公钥,请参阅以下示例。
$ ssh-copy-id ~/.ssh/id_rsa netcomo@netcomoserver
$ ssh-copy-id ~/.ssh/id_rsa netcomo2@netcomoserver
.