Git pull 和 push 在 Windows 中有效,但在 VM 中无效 [英] Git pull and push works in Windows but not in VM

查看:14
本文介绍了Git pull 和 push 在 Windows 中有效,但在 VM 中无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近建立了一个 Git 存储库,经过一番摆弄后,我设法正确设置了所有内容,以便我可以在我的 Windows 8.1 环境中使用 SSH 密钥从 Git 拉取和推送,并从 Gitlab 拉取......但是在我的Ubuntu VM 我尝试做同样的事情(如果有帮助的话,在两种环境中都是通过命令行)并且它开始要求我输入密码,这对我来说会暗示 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

问候,尼尔

推荐答案

首先,不要将 Windows 密钥复制到 Ubuntu ~/.ssh 中.私钥被称为私有是有原因的;)

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

其次,检查你的新id_rsaid_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 pull 和 push 在 Windows 中有效,但在 VM 中无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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