如何使用 GitBash 通过 ssh 克隆数据(windows 10 环境) [英] How to use the GitBash to clone data with ssh (windows 10 environment)
问题描述
我该如何解决这个问题?
当我想连接我的个人 GitLab 帐户时,我收到如下图所示的错误消息
### shell 脚本git clone git@gitlab.com:<用户名>/test1.git
<块引用>GitLab 服务器端
<块引用>克隆ssh地址
PS:我检查并找到了一些来自 StackOverflow 的参考资料,但不幸的是,这对我来说不合适
1.
第 2 步:
ssh-keygen
(使用回车键作为默认值)第三步:设置配置文件
vim/c/Users/Willie/.ssh/config
<块引用>
托管 gitlab.com
主机名 gitlab.com
用户 git
身份文件 ~/.ssh/id_rsa
第 4 步:
git clone git@gitlab.com:<用户名>/test2.git
第 5 步:
完成第 4 步后
1.test2.git文件下载完成
2.您将在 ~/.ssh
中获得新文件(known_hosts)
PS:我自己创建了 id_rsa 和 id_rsa.ub 并将其交付给 Gitlab 服务器.使用任何客户端(Windows 和 Linux)的两个键.
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 server-side
Clone ssh address
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.
Step 1:
ls -al ~/.ssh
Step 2:
ssh-keygen
(using enter key for default value) Step 3: To setup config file
vim /c/Users/Willie/.ssh/config
Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/id_rsa
Step 4:
git clone git@gitlab.com:<username>/test2.git
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: 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屋!