Windows上的SourceTree:如何连接到SSH? [英] SourceTree on Windows: How to connect to SSH?

查看:626
本文介绍了Windows上的SourceTree:如何连接到SSH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过SSH访问我的虚拟主机,它可以与PuTTY一起使用(我只需要输入我的域,用户名和密码),但是SourceTree似乎要复杂得多.

I have an SSH access to my web hosting, it works great with PuTTY (I just had to enter my domain, username and password), however it seems much more complicated with SourceTree.

虽然PuTTY具有主机名",用户名"和密码"的字段,但SourceTree没有,并且需要特殊文件".ppk"?!

While PuTTY has a field for "Host Name", "username" and "password", SourceTree doesn't and requires a special file ".ppk"?!

出于明显的原因,我想通过SSH将SourceTree连接到我的虚拟主机,因为我想使用它推送到位于我的虚拟主机上的远程存储库.

I need to connect SourceTree to my web hosting via SSH for the obvious reason that I want to use it to push to a remote repository located on my web hosting.

所以如何从我的域/用户名/密码生成一个.ppk文件?任何帮助,我们将不胜感激!

So how do I get a .ppk file generated from my domain/username/password? Any help greatly appreciated!

PS:我注意到,它们通过提供两个简单字段(用户名"和密码")使连接到BitBucket异常容易,并且使连接到第三方SSH异常困难. ..是否有意阻止竞争?!

推荐答案

有两种方法将SourceTree连接到任何SSH.

There are two ways to connect SourceTree to any SSH.

最简单的方法是使用网络托管服务提供商提供的域名,用户名和密码:

只需使用以下语法:ssh://username@example.com/ –每当您按下该SSH时,SourceTree就会提示您输入密码:

Simply use the following syntax: ssh://username@example.com/ – SourceTree will then prompt you to enter your password whenever you push to that SSH:

如果选中Remember password复选框,则将保存您的密码,并且不会再次提示您输入密码.您可以稍后通过转至Tools > Options > Authentication来编辑或删除存储的密码,如下图所示:

If you check the Remember password checkbox, your password will be saved and you will not be prompted again for it. You can edit or remove the stored password at a later time by going to Tools > Options > Authentication as shown on the image below:

注意:在我的情况下(1和1共享主机),用户名和密码都与我的主FTP帐户相同.

Note: In my case (1&1 Shared Hosting), the username and password were both the same as my main FTP account.

更复杂的方法是使用私钥/公钥对:

这意味着使用" PuTTY密钥生成器"(在SourceTree中转到Tools > Create or Import SSH Keys)来生成两个密钥(一个私有"和一个公共").

This implies generating two keys (one "private" and one "public") using the "PuTTY Key Generator" (in SourceTree go to Tools > Create or Import SSH Keys).

生成后,将私钥保存到.ppk文件并将其加载到SourceTree(Tools > Create or Import SSH Keys > Load)中.还没有结束:现在,您必须将公钥添加到服务器.为此,请将其添加到Web服务器上的以下文件中:/.ssh/authorized_keys.

Once generated, save the private key to a .ppk file and load it in SourceTree (Tools > Create or Import SSH Keys > Load). It's not over yet: now you must add the public key to your server. To do that, add it to the following file on your web server: /.ssh/authorized_keys.

如果该文件不存在,请将您的公共密钥保存到名为authorized_keys的文件中,然后通过FTP将其上传到您的服务器.您必须将其上载到位于根目录下的名为/.ssh/的目录中(如果不存在,只需创建它).

If this file doesn't exist, save your public key to a file named authorized_keys and upload it to your server via FTP. You must upload it into a directory named /.ssh/ located at the root (if it doesn't exist, simply create it).

注意:确保使用托管帐户的 main FTP帐户.如果不起作用,请使用您的FTP软件(Right-click on "authorized_keys" > File permissions)调整authorized_keys文件的权限(chmod)并将其设置为777:

Note: Make sure to use the main FTP account of your hosting account. If it doesn't work, adjust the permissions (chmod) of the authorized_keys file and set it to 777 using your FTP software (Right-click on "authorized_keys" > File permissions):

完全不需要命令行.

这篇关于Windows上的SourceTree:如何连接到SSH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆