Git pull and push works in Windows but not in VM

2019-04-17 11:40发布

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.

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

Regards, Neil

1条回答
Melony?
2楼-- · 2019-04-17 12:20

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

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.

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.

查看更多
登录 后发表回答