Git在Windows中运行,而不是在VM中运行 [英] Git pull and push works in Windows but not in VM

查看:155
本文介绍了Git在Windows中运行,而不是在VM中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近设置了一个Git仓库,经过一番捣鼓之后,设法正确地设置了一切,这样我就可以在Windows 8.1环境中使用SSH密钥从Git中拉出并推送Gitlab,但是在我的Ubuntu VM我尝试做同样的事情(如果有帮助的话,在命令行中都是这样),它开始向我要求一个密码,这对我来说会建议虚拟机不知道我的SSH密钥的位置?尽管如此,我仍然可以解决这个问题。

I've recently set up a Git repository and after some fiddling managed to get everything set up correctly so that I could pull and push from Git in my Windows 8.1 environment using SSH keys and pulling from Gitlab ... however in my Ubuntu VM I try to do the same thing (all from command line by the way in both environments if that helps) and it starts asking me for a password which to me would suggest that the VM doesn't know the location of my SSH keys? I could be way off with that thought though.

我可以非常高兴地从VM检查git状态。这不是世界末日,因为我可以使用Windows环境,但我仍然在学习所有这些,并想知道为什么会这样做......

I can quite happily check git status from the VM. This isn't the end of the world as I can use the Windows environment but I'm still learning all of this and wanted to know why it would be doing that ...

感谢您对此事的任何建议

Thank you for any advise on the matter

问候,
尼尔

推荐答案

首先,不要在你的Ubuntu〜/ .ssh中复制你的Windows密钥。 )私人密钥因为某种原因被称为私人密钥;)

First, don't copy your windows keys in your Ubuntu ~/.ssh. The private key is called private for a reason ;)

其次,请检查您需要在新客户端中生成新的 id_rsa id_rsa.pub 文件的权限环境(Ubuntu的一个)。 ls -alrt〜/ .ssh 会为您提供这些信息。

Second, do check the permission of your new id_rsa and id_rsa.pub files that you need to generate in your new client environment (the Ubuntu one). A ls -alrt ~/.ssh will give you those information.

如果您重新生成新密钥环境(请参阅 GitLab ssh文档),不要忘记添加公共键入你的GitLab配置文件。

And if you regenerate new keys in that environment (See GitLab ssh documentation), don't forget to add the public key in your GitLab profile.

这篇关于Git在Windows中运行,而不是在VM中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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