使用Windows PowerShell设置.SSH键时出错 [英] Error in setting up .SSH keys with Windows PowerShell

查看:604
本文介绍了使用Windows PowerShell设置.SSH键时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Git BASH shell可以正常使用SSH密钥,所以我知道我的基本配置步骤是正确的,但我更喜欢windows powershell(实际上我更喜欢Mac或Linux终端,但是没有可用的选项。 ..)



无论如何。



我的Windows PowerShell是在PS1脚本文件中设置的
http://markembling.info/2009/09/ssh-agent -in-powershell 和我所知道的,启动运行正常

 启动SSH代理.. 。
SSH代理程序PID:5064

但是当我尝试SSH或运行git命令从powershell,我仍然提示输入密码。有没有人见过这个?我更喜欢PS给Git Bash,但会在最糟糕的情况下继续使用它。



编辑 - VonC提供的答案= Add%HOME%to windows系统环境变量

 查看或更改环境变量:

右键单击我的电脑,然后然后单击属性。
单击高级选项卡。
单击环境变量。
在用户变量下单击以下选项之一:
单击新建
变量名称`HOME`(不包含引号或百分号)
值:C:\文档和设置\ **你的用户名**

重新启动powershell(或者你喜欢的任何shell)和你的SSH工程 / code>。

它可能自然地设置在bash会话中,但在Windows(这里是PowerShell)会话中,它没有默认定义。



最好在用户环境变量级别定义该变量,以便从中继承所有shell。


I've got the GIT BASH shell working correctly with SSH keys, so I know my basic configuration steps are correct, but I prefer the windows powershell (actually I prefer the Mac or Linux terminal, but out of the available options...)

Anyways.

My windows powershell is set up with the PS1 script fount in this blog post http://markembling.info/2009/09/ssh-agent-in-powershell and from what I can tell, the start up is running correctly

Starting SSH agent...
SSH agent PID: 5064

But when I try to SSH in or run git commands from powershell, I'm still prompted for a password. Has anyone seen this before? I prefer PS to Git Bash but will stick with it in the worst case.

EDIT - Answer provided by VonC = Add %HOME% to windows system environment variables

To view or change environment variables:

Right-click My Computer, and then click Properties.
Click the Advanced tab.
Click Environment variables.
Click one the following options, under user variables:
    Click New 
         variable name `HOME` (No quotes, or percentage signs) 
         value: C:\Documents and Settings\**your username**

Restart powershell (or whatever shell you love) and your SSH works by default.

解决方案

The first element to check is the value of the environment variable %HOME%.
It might be naturally set in a bash session, but in a Windows (here PowerShell) session, it is not defined by default.

It is best to defined that variable at the "User Environment Variables" level, for all shells to inherit from it.

这篇关于使用Windows PowerShell设置.SSH键时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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