git 如何使用 ssh 将 tortoisegit 设置为不需要密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10163271/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set up tortoisegit to not require password using ssh
提问by Justin Pihony
I am having trouble getting git/tortoisegit to use my supplied ssh key (created using PuttyGen). In the command prompt I get a permission denied
error, and in the TortoiseGit UI I get prompted for a password. I tried this SO question, but as stated, I created with PuttyGen, have Pageant running with my keys loaded, and am configured to use TortoisePlink.
我无法让 git/tortoisegit 使用我提供的 ssh 密钥(使用 PuttyGen 创建)。在命令提示符中,我收到permission denied
错误消息,在 TortoiseGit UI 中,我收到输入密码的提示。我尝试了这个 SO question,但如前所述,我使用 PuttyGen 创建,在加载了我的密钥的情况下运行 Pageant,并配置为使用 TortoisePlink。
I then found this SO question, and tried to use the ssh in the git directory, the TortoisePlink in my TortoiseHG (used for Bitbucket/Mercurial), and as stated, had already tried the local TortoisePlink in TortoiseGit.
然后我找到了这个 SO question,并尝试使用 git 目录中的 ssh,我的 TortoiseHG 中的 TortoisePlink(用于 Bitbucket/Mercurial),并且如上所述,已经尝试过 TortoiseGit 中的本地 TortoisePlink。
Oh, and I did set up my ppk in my Git account, as well as, in the Git->Remote section of TortoiseGit
哦,我确实在我的 Git 帐户中以及 TortoiseGit 的 Git->Remote 部分中设置了我的 ppk
So, what am I missing?
那么,我错过了什么?
回答by CGRobinson
Check what your origin url is.
检查您的原始网址是什么。
Right click on your project folder
TortoiseGit
-> Settings
-> Choose Git
-> Remote
and select the origin entry.
右键单击您的项目文件夹
TortoiseGit
-> Settings
-> 选择Git
->Remote
并选择源条目。
Check that the url starts with ssh://
and that your private key is loaded.
检查 url 是否以 开头ssh://
以及您的私钥是否已加载。
If the url starts with https://
then it will ask you for your password every time.
如果 url 以 开头,https://
那么它每次都会询问您的密码。
Hope this helps.
希望这可以帮助。
回答by O. R. Mapper
Some Git servers are somewhat counterintuitive (IMHO) when it comes to authentication. For instance, Github docssay:
当涉及到身份验证时,一些 Git 服务器有点违反直觉(恕我直言)。例如,Github 文档说:
All connections must be made as the "git" user.
所有连接都必须以“git”用户身份进行。
So, instead of trying to connect to ssh://<yourname>@github.com...
, you have to connect to ssh://[email protected]...
.
因此,您不必尝试连接到ssh://<yourname>@github.com...
,而必须连接到ssh://[email protected]...
。
I am not asked for a password any more and TortoiseGit now shows Success
after completing a Pushoperation.
不再要求我输入密码,TortoiseGit 现在Success
在完成Push操作后显示。
回答by Sander P
I could not make this work with github/tortoisegit either. Using git from the command line on linux worked fine. I then resorted to using my username/password as described here:
我也无法使用 github/tortoisegit 完成这项工作。在 linux 上从命令行使用 git 工作正常。然后我使用我的用户名/密码,如下所述:
http://www.programmoria.com/2012/02/saving-tortoisegit-password.html
http://www.programmoria.com/2012/02/saving-tortoisegit-password.html
and elsewhere. It is not a real solution (sorry) but a workaround that achieves the same thing: automatic authentication without having to enter your username/password. The _netrc file is as secure/insecure as the private key that would also be stored somewhere on your computer so I consider it an acceptable solution. Comments on this are welcomed of course.
和其他地方。这不是真正的解决方案(抱歉),而是实现相同目的的解决方法:无需输入用户名/密码即可自动进行身份验证。_netrc 文件与私钥一样安全/不安全,私钥也会存储在您的计算机上的某处,因此我认为这是一个可以接受的解决方案。当然,欢迎对此发表评论。
回答by mzzzzb
I was also facing the same problem on v1.8.4, then I switched my ssh client to plink and its working fine now. TortoiseGit Settings -> Network -> SSH client
我在 v1.8.4 上也遇到了同样的问题,然后我将我的 ssh 客户端切换到 plink 并且它现在工作正常。TortoiseGit 设置 -> 网络 -> SSH 客户端
plink is distributed along with peagent and other goodies in standard putty package
plink 与标准腻子包中的 peagent 和其他好东西一起分发
Apparently there is a bug in certain versions of TortoiseGit (TortoisePlink in particular) see this answer
显然,某些版本的 TortoiseGit(特别是 TortoisePlink)中存在一个错误, 请参阅此答案
回答by Attila Szeremi
Does your account on the OpenSSH server know you should be authorized with your public key?
您在 OpenSSH 服务器上的帐户是否知道您应该使用您的公钥进行授权?
Load your key with PuTTyGen. You will see a read-only textarea under "Public key for pasting into OpenSSH authorized_keys file". Copy what's in there.
使用 PuTTyGen 加载您的密钥。您将在“用于粘贴到 OpenSSH 授权密钥文件的公共密钥”下看到一个只读文本区域。复制里面的东西。
SSH with PuTTy into the SSH server. Open up the ~/.ssh/authorized_keys
file with an editor and paste the copied text in a new line and save. The ~/.ssh
directory may not exist yet. In that case, do mkdir ~/.ssh
before editing that file.
使用 PuTTy SSH 进入 SSH 服务器。~/.ssh/authorized_keys
使用编辑器打开文件并将复制的文本粘贴到新行中并保存。该~/.ssh
目录可能还不存在。在这种情况下,请mkdir ~/.ssh
在编辑该文件之前执行。
回答by Tue
I am using git 2.7 and tortoisegit 1.8.16 Here is what I did to avoid requiring password and it worked for my case
我正在使用 git 2.7 和 tortoisegit 1.8.16 这是我为避免需要密码所做的工作,它适用于我的情况
Right click on your project folder TortoiseGit -> Settings Choose Git -> Remote and select the origin entry Change url from https://github... to ssh://git@github...
右键单击您的项目文件夹 TortoiseGit -> Settings 选择 Git -> Remote 并选择原始条目 将 url 从https://github...更改为 ssh://git@github ...
回答by Lukos
Using Tortoise 2.2.0.0, you need to do a couple of things. On the remote tab, you can either remove the http(s) origin you already have or you need to add a second, using ssh:// and checking the "Push Default" checkbox for the ssh one so that Tortoise uses it for pushes by default (and the https origin in my case for pull).
使用 Tortoise 2.2.0.0,您需要做一些事情。在远程选项卡上,您可以删除已有的 http(s) 源,也可以添加第二个源,使用 ssh:// 并选中 ssh 的“推送默认”复选框,以便 Tortoise 将其用于推送默认情况下(在我的情况下为拉取 https 来源)。
Only the ssh one needs the key specified and then when you Push, it should default to your new ssh origin as the destination and not ask for your username and password.
只有 ssh 需要指定的密钥,然后当你推送时,它应该默认为你的新 ssh 源作为目的地,而不是询问你的用户名和密码。
Obviously you need to know what user to have in your URL. For example, in Visual Studio Team Services, it is the name of the VSTS account (not account holder!). You might also need the port number.
显然,您需要知道您的 URL 中有哪些用户。例如,在 Visual Studio Team Services 中,它是 VSTS 帐户的名称(不是帐户持有人!)。您可能还需要端口号。
That's all I did to setup from scratch and it worked fine.
这就是我从头开始设置的全部内容,并且运行良好。