从共享主机 (Hostgator) 添加远程回购到 SourceTree

Add Remote Repo From Shared Hosting (Hostgator) To SourceTree

1) 我在我的 Windows 开发机器上设置了一个本地 git 仓库。

2) 使用 hostgator

在我的云托管帐户上创建了一个远程仓库

3) 在本地计算机上生成 SSH 密钥。

4) 为 hostgator 添加了密钥

5) 我可以在端口 2222 w/out 上通过 ssh 连接到我的服务器。所以现在我的本地和远程回购已成功链接。

当我尝试将远程仓库(在 hostgator 上)添加到 SourceTree 时出现问题。

Sourcetree 不加载 SSH 密钥,除非它们是 ppk 格式(我的密钥不是) 因此,我使用 Putty 生成了新的密钥对,并将它们添加到 hostgator 和 sourcetree SSH 代理中。

现在我不确定是否将正确的远程仓库地址输入到 SourceTree

我尝试了什么:

ssh://<username>@mywebsite.com:2222/path/to/my/remote/repo.git

and

<username>@mywebsite.com:2222/path/to/my/remote/repo.git

我不确定问题是由于地址错误还是新的 ssh 密钥引起的。

当我尝试从 SourceTree 上的远程仓库获取时,我得到:

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch <name of repo>
FATAL ERROR: Server unexpectedly closed network connection
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.



Completed with errors, see above.

我的问题是:

1) 我生成新的 ppk 密钥并链接它们的步骤是否错误?

2) 我应该与 SourceTree 一起使用的 url/path 是什么?

我卡住了:(

经过几天的研究,我终于找到了解决方案。

正如我在问题中提到的,Sourcetree 使用 Putty 作为 SSH 代理,但在我的案例中不起作用。

我需要做的是告诉 SourceTree 使用 OpenSSH。

为此,必须:

工具 > 选项

在 "SSH Client Configuration" 下的常规选项卡下,选择 OpenSSH 而不是 Putty/Plink。

并确保您已指向用于通过服务器验证 git 的 SSH 密钥;就我而言 ~/.ssh/id_rsa

就这些了。