如何使用GitBash通过ssh克隆数据(Windows 10环境) [英] How to use the GitBash to clone data with ssh (windows 10 environment)

查看:249
本文介绍了如何使用GitBash通过ssh克隆数据(Windows 10环境)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何解决这个问题?
当我想连接我的个人GitLab帐户时,收到一条错误消息,如下图所示

What can I solve this problem?
when I wanted to connect my personal GitLab account, I got an error message like the following picture

### shell script     
git clone git@gitlab.com:<username>/test1.git

GitLab服务器端

GitLab server-side

克隆ssh地址

Clone ssh address

PS:我检查了一下并找到了StackOverflow的一些参考,但不幸的是,这对我来说不行
1. 通过ssh进行git克隆
2. SSH和Git克隆
3. 带有ssh问题的git clone

PS: I have checked and found some reference from StackOverflow but unfortunately it isn't okay for me
1.git clone through ssh
2.SSH and Git Clone
3.git clone with ssh issue

推荐答案

我找到了很好的参考资料,但对

I have found a great reference but sorry for Mandarin website, however, I can use my way to share how to deal with this issue.

第1步:

ls -al ~/.ssh

第2步:

ssh-keygen 

(使用Enter键作为默认值) 第3步:设置配置文件

(using enter key for default value) Step 3: To setup config file

vim /c/Users/Willie/.ssh/config

主持人gitlab.com
主机名gitlab.com
用户git
IdentityFile〜/.ssh/id_rsa

Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/id_rsa

第4步:

git clone git@gitlab.com:<username>/test2.git

第5步:
完成第4步后
1. test2.git文件将被下载完成
2.您将在〜/.ssh中获得新文件(known_hosts)

Step 5:
When you finished Step 4
1.the test2.git file will be download done
2.you will get the new file(known_hosts) in the ~/.ssh

PS:我自己创建了id_rsa和id_rsa.ub,并将其交付给Gitlab服务器.使用这两个密钥访问任何客户端(Windows和Linux).

PS: I create the id_rsa and id_rsa.ub by myself and I deliver it to the Gitlab server. using both keys to any client-sides(windows and Linux).

这篇关于如何使用GitBash通过ssh克隆数据(Windows 10环境)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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