简体   繁体   English

无法从 siteground 克隆 git 存储库

[英]Unable to clone git repository from siteground

I'm trying to set up MS WebMatrix to use a Git repository from my siteground hosting account.我正在尝试设置 MS WebMatrix 以使用来自我的 siteground 托管帐户的 Git 存储库。 I created the repository using their cpanel plugin and it tells me that I can clone it using this command我使用他们的 cpanel 插件创建了存储库,它告诉我可以使用此命令克隆它

git clone ssh://username@sm3.siteground.biz:18765/home/username/public_html/

I replaced username of course and I created an rsa key using ssh-keygen.我当然替换了用户名,并使用 ssh-keygen 创建了一个 rsa 密钥。 In the Webmatrix GUI it just opens a window saying "Clone is in progress" but it doesn't to anything.在 Webmatrix GUI 中,它只是打开一个窗口,上面写着“克隆正在进行中”,但它没有做任何事情。 And when I run that command in PowerShell, this is the output:当我在 PowerShell 中运行该命令时,输出如下:

    Cloning into 'public_html'...
    Permission denied (publickey).
    fatal: Could not read from remote repository.

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

Any help is highly appreciated!任何帮助表示高度赞赏!

EDIT: I haven't used github before but I'm pretty sure I'm not connecting to it.编辑:我以前没有使用过 github,但我很确定我没有连接到它。 The repository is on siteground's server I think.我认为该存储库位于 siteground 的服务器上。 Anyway, I couldn't figure it out in PowerShell so now I'm using putty to load the appropriate key and connect using an external git tool (source tree) that doesn't use the same ssh client as PowerShell.无论如何,我无法在 PowerShell 中弄清楚,所以现在我使用 putty 加载适当的密钥并使用外部 git 工具(源树)进行连接,该工具不使用与 PowerShell 相同的 ssh 客户端。 That is the solution that's working for me now.这就是现在对我有用的解决方案。 I'll leave this question open as maybe someone comes around and can help with how to set this up using PowerShell.我将这个问题悬而未决,因为也许有人会出现并可以帮助您使用 PowerShell 进行设置。

The missing piece to the Siteground guide is: Siteground 指南缺失的部分是:

  1. Create a blank file in ~/.ssh/ or C:\\Users\\username\\.ssh on your computer.在计算机上的~/.ssh/C:\\Users\\username\\.ssh创建一个空白文件。 It does not matter what you name it.你给它起什么名字并不重要。 I named it siteground_dsa .我将其命名为siteground_dsa You could also name it id_dsa_siteground .您也可以将其命名为id_dsa_siteground

  2. Copy the private ssh key that you get from siteground.com and paste the whole of it in the this newly created file.复制您从 siteground.com 获得的私有 ssh 密钥,并将其全部粘贴到这个新创建的文件中。

  3. Open Git Bash locally on your computer and run the following command在您的计算机上本地打开 Git Bash 并运行以下命令

    $ eval ssh-agent -s $ eval ssh-agent -s

  4. Then run the following.然后运行以下。 Remember to use the filename that you gave it.请记住使用您提供的文件名。

    $ ssh-add ~/.ssh/siteground_dsa $ ssh-add ~/.ssh/siteground_dsa

  5. Now you need to enter the passphrase for the ssh key.现在您需要输入 ssh 密钥的密码。 You will have defined it when creating the ssh key.您将在创建 ssh 密钥时定义它。

  6. Now you should be logged in and you can run git clone the directory of your wish.现在你应该已经登录了,你可以运行git clone你想要的目录。

    git clone ssh://username@ams14.siteground.eu:18765/home/username/public_html/

To permanently add the SSH key extend ~/.ssh/config with the following and updating server_name and username .要永久添加 SSH 密钥,请使用以下内容扩展~/.ssh/config并更新server_nameusername

Host server_name
     User username
     Port 18765
     IdentityFile ~/.ssh/siteground_dsa

GitHub isn't able to authenticate you. GitHub 无法对您进行身份验证。 Probably your key isn't associated with your GitHub account.可能您的密钥与您的 GitHub 帐户无关。

Take a look to GitHub's recommended method看看GitHub推荐的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM