简体   繁体   English

Windows上的Git SSH访问

[英]Git ssh access on windows

I have set-up a repository at a Gitlab cloud server (linux-based). 我已经在Gitlab云服务器(基于Linux)上建立了一个存储库。 I created a new repo there following the basic instructions. 我按照基本说明在此处创建了一个新的存储库。

git@code.example.com:mike/repo.git

I add the repo as a remote to my local git 我将存储库添加为本地git的远程目录

git remote add gitlab git@code.example.com:mike/repo.git

I have generated a (pk, sk) key-pair using Puttygen on a windows machine. 我已经在Windows机器上使用Puttygen生成了一个(pk,sk)密钥对。 I add these in Users/mike/.ssh as id_rsa follwing the instructions from 我将它们添加到Users / mike / .ssh中,作为id_rsa遵循以下说明

https://serverfault.com/questions/194567/how-do-i-tell-git-for-windows-where-to-find-my-private-rsa-key https://serverfault.com/questions/194567/how-do-i-tell-git-for-windows-where-to-find-my-private-rsa-key

Furthermore, I add the public key under DeployKeys for the repository in Gitlab. 此外,我将公共密钥添加到Gitlab中存储库的DeployKeys下。

Unfortunately, when I try (in Git bash) 不幸的是,当我尝试(使用Git bash)

git push -u gitlab master

it stills asks for my git user password git@code.example.com:mike/repo.git's password? 它仍然要求我的git用户密码git@code.example.com:mike / repo.git的密码?

when I try 当我尝试

ssh -v git@code.example.com:mike/repo.git

it comes back with ssh: Could not resolve hostname code.example.com:mike/repo.git: no address associated with name 它与ssh一起返回:无法解析主机名code.example.com:mike/repo.git:没有与名称关联的地址

Not clear what I am missing. 不清楚我缺少什么。 Any thoughts? 有什么想法吗?

Cheers, Mike 干杯,迈克

  1. Go to the User Profile 转到用户个人资料
  2. Click ssh keys on the left menu 单击左侧菜单上的ssh键
  3. Add your ssh key 添加您的ssh密钥

添加SSH密钥

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM