首页 \ 问答 \ Cygwin上的Git:无法将主机添加到已知主机列表中(Git on Cygwin: Fails to add the host to the list of known hosts)

Cygwin上的Git:无法将主机添加到已知主机列表中(Git on Cygwin: Fails to add the host to the list of known hosts)

我在Windows 7上使用cygwin git,每次我执行任何需要通过SSH与github进行通信的操作时,我都会收到以下消息:

Could not create directory '/home/ltb/.ssh'.
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?

到目前为止,我知道上面发生了什么。 但是一旦输入yes,SSH应该能够将github密钥插入到known_hosts文件中并移动。 相反,我每次都会收到以下错误消息:

Failed to add the host to the list of known hosts (/home/ltb/.ssh/known_hosts).

我究竟做错了什么?


I'm using cygwin git on windows 7 and everytime I do any operation that requires communication with github via SSH, I get the following message:

Could not create directory '/home/ltb/.ssh'.
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?

So far so good, I understand what's going on above. But once I enter yes, SSH should be able to insert the github key in the known_hosts file and move. Instead I get the following error message everytime:

Failed to add the host to the list of known hosts (/home/ltb/.ssh/known_hosts).

What am I doing wrong?


原文:https://stackoverflow.com/questions/25703860
更新时间:2019-06-21 03:06

最满意答案

我写了一篇关于这个问题的博客文章 。 解决方案在于,如上所列,cygwin中的主文件夹很可能位于/cygdrive/c/home/ltb/下, /home/ltb//home/ltb/下。 你可以像这样修复它:

  1. 找到passwd文件,通常在C:\ cygwin \ etc \
  2. 用你的首选编辑打开它
  3. 在以用户名开头的行上,将读取/home/<user>的部分更改为/cygdrive/c/home/<user> ,其中<user>是您的cygwin用户名。 如果不同,请相应调整此路径。
  4. 保存更改并重新启动Cygwin终端

希望这可以帮助...


I wrote a blog post about this very problem. The solution lies in the fact that your home folder in cygwin is most likely under /cygdrive/c/home/ltb/ and NOT under /home/ltb/ as you listed above. You can fix it like this:

  1. Locate the passwd file, which is usually at C:\cygwin\etc\
  2. Open it with your prefered editor
  3. On the line that starts with your username, change the section that reads /home/<user> to read /cygdrive/c/home/<user> where <user> is your cygwin username. Adjust this path accordingly if different.
  4. Save the changes and restart the Cygwin Terminal

Hope this helps...

2014-09-06

相关问答

更多

我怎样才能在我的Python Fabric`fabfile.py`的函数中正确设置`env.hosts`?(How can I properly set the `env.hosts` in a function in my Python Fabric `fabfile.py`?)

@Chris,你看到这种行为的原因是因为主机列表是在任务函数被调用之前构造的。 所以,即使你正在改变函数中的env.hosts ,它已经太晚了,没有任何效果。 而命令fab setenv:foo mycmd:bar会导致你期望的结果: $ fab setenv:foo mycmd:bar [myhost] Executing task 'mycmd' ['myhost'] [myhost] run: ls 这与被接受的答案是一样的,但是由于setenv被定义的方式,所以需要一个参数。 另一个例子 ...

不能在Windows上使用cygwin启动git gui(Cannot launch git gui using cygwin on windows)

编辑 :最新到2016年3月,以重新命名包裹等 Cygwin的gitk和git gui需要X11。 这意味着您需要安装一些Cygwin X11软件包,并将其设置为能够打开GUI。 这应该让你开始运行: 再次运行Cygwin安装程序(如果需要,请再次下载相关设置 - * .exe )。 在软件包列表中,选择在X11类别下安装“xinit”。 单击下一步,接受所有依赖项,然后安装。 在Windows开始菜单中,您应该有一个新的组:Cygwin-X。 从那里运行XWin Server。 在Cygwin ...

克隆与docker文件的私人git repo(Clone private git repo with dockerfile)

我的密钥受到密码保护,导致问题,下面列出了一个工作文件(为将来的Google员工提供帮助) FROM ubuntu MAINTAINER Luke Crooks "luke@pumalo.org" # Update aptitude with new repo RUN apt-get update # Install software RUN apt-get install -y git # Make ssh dir RUN mkdir /root/.ssh/ # Copy over p ...

Capistrano错误 - 无效选项:known_hosts(Capistrano error - Invalid options(s): known_hosts)

我有同样的问题。 将net-ssh从3.0.2更新到3.1.1之后,它正在运行。 gem update net-ssh I had same issue. After update net-ssh from 3.0.2 to 3.1.1, it is working. gem update net-ssh

gcc / cygwin如何获得DNS服务器?(How does gcc/cygwin get the DNS server?)

正如nm所说 ,如果Cygwin使用Windows解析器, res_init()不会填充_res.nsaddr_list 。 如果/etc/resolv.conf不存在,或者/etc/resolv.conf包含options osquery ,则使用Windows解析器。 在我看来,这是一个Cygwin错误 - 返回一个负数的nscount是假的 - 但是,尽管如此,我们仍然坚持解决它。 解决方法是像Cygwin自己一样调用GetNetworkParams() - 这就是我作为后备的做法: #in ...

Ansible网络模块与提供商中的多个主机(Ansible network module with multiple hosts in the provider)

您可以使用模板提供者变量并利用Ansible的主循环机制: 主机: [devices] 192.168.1.222 192.168.1.200 剧本: - hosts: devices connection: local vars: cli: host: "{{ inventory_hostname }}" username: admin password: PASS1 authorize: yes auth_pass: ...

当一些主机不存在时,爬过主机列表(Crawling through list of hosts when some don't exist)

如果您愿意,可以尝试捕捉异常,处理并继续。 import paramiko host = ['cpu1','cpu2','cpu3'] ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) for i in host: str(i) try: ssh.connect(i, username='user', password='pass') ...

Ansible在本地和远程主机之间的SSH授权(SSH authorization in Ansible between local and remote host)

我将Vagrant框公钥复制到容器的authorized_keys和使用此标记的主机中: ansible_ssh_extra_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" 这只允许来自Ansible> 2.0 I copy the Vagrant box public key to the container's authorized_keys and in the hosts using this tag: ...

相关文章

更多

最新问答

更多
  • Android宽度:100%修复(网站接管问题)(Android width:100% fix (website takeover issue))
  • C ++函数/方法设计的良好实践(Good practice in C++ function/method design)
  • 计算其他表中不存在的所有记录 - SQL查询(Count all records that does not exist to other table - SQL Query)
  • 为什么我要用JPA共享ID?(Why do I get shared Ids with JPA?)
  • asp.net - 如何显示来自html格式的数据行的字段(asp.net - how to display a field from data row that is in html format)
  • 我们如何使用ActiveRecord从连接表中删除行?(How can we delete rows from a join table by using ActiveRecord?)
  • ng-class搞乱了类的顺序(ng-class messing with the order of classes)
  • oracle 12g无效数字错误(oracle 12g invalid number error)
  • 更改ng-src值onclick(Change ng-src value onclick)
  • 如何在android中自动添加自定义依赖项以创建新项目?(How to add custom dependencies automatically in android for ever a new project is created?)
  • datetime函数在PHP中(datetime function in php)
  • 在javascript中获取会话数组的值(in javascript get the value of a session array)
  • 如何在UTF8中编译LaTeX?(How can I compile LaTeX in UTF8? [closed])
  • Rspec:“array.should == another_array”,但不用担心订单(Rspec: “array.should == another_array” but without concern for order)
  • Logcat错误:无法在android片段中加载视图(Logcat error: unable to load view in android fragments)
  • JavaFX的。(JavaFX. Adding items to the list in different threads is not working)
  • 从GDATA日历资源迁移到Google Calendar Resource api(Migrate from GDATA calendar resource to Google Calendar Resource api)
  • SSRS 2008 - 以零情景处理分割(SSRS 2008 - Dealing with division by zero scenarios)
  • 我如何以编程方式添加一个listView列标题的点击事件(How can I add a listView column header a click event programmatically)
  • Wxpython:无法检索有关列表控件项XXX的信息(Wxpython: Couldn't retrieve information about list control item XXX)
  • 使用Tortoise SVN在SVN存储库中移动目录(Move Directory across SVN repository using Tortoise SVN)
  • 天蓝色服务结构集群中的web api无状态服务是否在一段时间不活动后进入休眠状态?(Do web api stateless services in azure service fabric cluster go to sleep after a period of inactivity?)
  • 我可以设置intelliJ来突出显示PHP编码风格吗?(Can I set intelliJ to highlight php coding style?)
  • 用javafx创建一个Truetype字体文件(Creating a Truetype Font file with javafx)
  • Spring ftp配置错误(Spring ftp configuration is wrong)
  • 使用gsub去除多个字符(Using gsub to strip multiple characters)
  • 续订推送证书并保持当前的App Store App正常工作(Renew Push certificate and keep current App Store App working)
  • js:ES5和ES6之间关于'this'关键字用法的一个令人困惑的观点(js: one confusing point about 'this' keyword usage between ES5 and ES6)
  • window.onload vs $(document).ready()(window.onload vs $(document).ready())
  • 在Swift中,如何声明一个符合一个或多个协议的特定类型的变量?(In Swift, how can I declare a variable of a specific type that conforms to one or more protocols?)