- 下载地直址: http://msysgit.github.io/
- 下载自己需对应的版本
-
安装需求及git编辑器选择根据自己喜好及使用习惯
这里我们使用git windows版本的独立终端窗口, checkout和commis 这块我们选择 as-is
- 配置生成密钥
打开git bash的窗口,我们查看是否存在ssh密钥
$ cd ~./ssh
bash: cd: ~./ssh: No such file or directory
- 提示无此目录
- 创建密钥key: 输入ssh-keygen -t rsa -C "XXX@mail.com"
自己的邮箱
一路回车
$ ssh-keygen -t rsa -C "XXX@mail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/admin/.ssh/id_rsa):
Created directory '/c/Users/admin/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/admin/.ssh/id_rsa.
Your public key has been saved in /c/Users/admin/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:UreMs3qPwSJhPcUnBQ2hzHTyXa7pOBMJ3qph4RLVjF8 XXX@mail.com
The key's randomart image is:
+---[RSA 3072]----+
| o ==. . |
| B * o.o |
| o B E + . |
| . + * B + |
| . + * S = |
| + o = * |
| . = o B . |
| o + o.= |
| . ..... |
+----[SHA256]-----+
- 查看密钥生成文件,打开id_rsa.pub文件后 复制gitlab帐户ssh key中
admin@env-machine MINGW64 ~/.ssh
$ pwd
/c/Users/admin/.ssh
admin/@env-machine MINGW64 ~/.ssh
$ ls
id_rsa id_rsa.pub known_hosts
- 测试连接情况
admin@env-machine MINGW64 ~/.ssh
$ ssh -T git@192.168.3.41
The authenticity of host '192.168.3.41 (192.168.3.41)' can't be established.
ECDSA key fingerprint is SHA256:ZcsnMVqtJ4paQk9hWt6J39D3tlGKWJLk/MCGHT4s/TA.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.3.41' (ECDSA) to the list of known hosts.
Welcome to GitLab, @root!
至此,出现welcom to gitlab成功登陆信息
- 设置自己的git信息
输入
git config --global user.name "Firstname Lastname" (此处name可修改也不是用于登录gitlab的登录名)
git config --global user.email "your_email@youremail.com"
设置自己的git信息即完成安装和设置,可以输入git config --list查看自己的git信息。
网友评论