【问题标题】:Add Remote Repo From Shared Hosting (Hostgator) To SourceTree从共享主机(Hostgator)添加远程仓库到 SourceTree
【发布时间】:2023-03-30 16:39:01
【问题描述】:

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

2) 使用 hostgator 在我的云主机帐户上创建了一个远程仓库

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

4) 为 hostgator 添加了密钥

5) 我可以通过 ssh 连接到我的服务器上的 2222 端口而无需通过。所以现在我的本地和远程存储库已成功链接。

当我尝试将远程 repo(在 hostgator 上)添加到 SourceTree 时,问题发生了。

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

现在我不确定我是否将远程 repo 的正确地址输入到 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/路径是什么?

我被困住了:(

【问题讨论】:

  • 您的 SourceTree 是否支持 PPK 密钥?
  • 是的,它只支持用putty生成或用putty转换的key。

标签: git ssh version-control atlassian-sourcetree


【解决方案1】:

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

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

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

为此,必须:

工具 > 选项

在“SSH 客户端配置”下的常规选项卡下,选择 OpenSSH 而不是 Putty/Plink。

并确保您已指向您用来向服务器验证 git 的 SSH 密钥;在我的情况下 ~/.ssh/id_rsa

就是这样。

【讨论】:

  • 您可以标记自己的答案,这也将有利于其他有类似问题的人。
猜你喜欢
  • 2017-03-08
  • 1970-01-01
  • 2013-07-05
  • 1970-01-01
  • 2013-02-07
  • 1970-01-01
  • 1970-01-01
  • 2021-04-07
  • 1970-01-01
相关资源
最近更新 更多