从Windows Cmd行运行git:关键文件在哪里? [英] Running git from Windows Cmd line: Where are key files?

查看:431
本文介绍了从Windows Cmd行运行git:关键文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我安装了msysgit,并从bash shell中成功运行git。



在bash shell中,我用 ssh-keygen - 一切正常。

关键文件位于我的%userprofile%\.ssh 文件夹中(来自bash shell,它是:〜/ .ssh )。

我能够连接到我的服务器(在我的情况下是不受干扰的) 。

接下来,我希望能够从Windows Cmd shell运行git。

添加 c:\\ \\ msysgit \bin c:\msysgit\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\在本地工作 就好:分支,合并,添加,提交,结帐,......运行良好。

然而,尝试使用服务器失败,出现:' Permission denied(publickey)。'

它看起来像git,当从命令行执行时看着不同的位置尝试分配密钥文件,或导致其失败的其他原因。

解决方案

要使mysysgit命令行找到.ssh键,您需要使用%HOME%指向包含.ssh文件夹的目录



通常您可以做

  set HOME =%USERPROFILE%


So I've installed msysgit, and run git successfuly from the bash shell.

From within the bash shell, I've created keys with ssh-keygen - everything works fine.
Key files are in my %userprofile%\.ssh folder (from the bash shell, it is: ~/.ssh).
I'm able to connect to my server (unfuddle in my case).

Next, I do want to be able to run git from the Windows Cmd shell.
Adding c:\msysgit\bin and c:\msysgit\mingw\bin to the search path.
Git is working locally just fine: branch, merge, add, commit, checkout, ... working well.

However, trying to work with the server fails, with: 'Permission denied (publickey).'
It looks like git, when executed from command line looks at a different location trying to allocated the key files, or another reason causing it to fail.

解决方案

To get the mysysgit command line to find the .ssh keys you'll need to have %HOME% point to the directory containing the .ssh folder

Often you can just do

set HOME=%USERPROFILE%

这篇关于从Windows Cmd行运行git:关键文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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