GitLab问题小节

1.关于如何获取Git public key

方法/步骤
1
首先要检查key是不是已经存在,
打开一个终端,并输入以下命令:
$ ls -al ~/.ssh
如果结果列表中包含以下文件, 则不需要在生成新的KEY, 可以直接使用。
id_dsa.pub
id_ecdsa.pub
id_ed25519.pub
id_rsa.pub
2
如果不存在, 则需要创建新的Key来使用。
输入下面的命令来生成key, 注意替换你自己的邮箱地址。
$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key using the provided email
Generating public/private rsa key pair.
Enter file in which to save the key (/your_home_path/.ssh/id_rsa):

这里在提示你保存key的位置, 默认直接回车就可以。

3
Enter passphrase (empty for no passphrase):
当你看到这个的时候, 输入你的密码。
Enter same passphrase again:
再次输入, 以确认密码。
4
当以上步骤成功完成后, 你将看到类似与这样的结果:
Your identification has been saved in /your_home_path/.ssh/id_rsa.
Your public key has been saved in /your_home_path/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
5
执行以下命令将KEY加入到ssh-agent:
$ eval "$(ssh-agent -s)"
# Agent pid 59566
$ ssh-add ~/.ssh/id_rsa
6
打开 ~/.ssh/id_rsa.pub文件, 复制其中所有的内容。然后把它粘贴到github的ssh key添加的表单中。
7
执行以下命令来测试key。
$ ssh -T git@github.com
如果你看到:
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
输入“yes”并回车。

当你看到以下内容时, 你就添加成功了。
Hi username! You've successfully authenticated, but GitHub does not
provide shell access.

参考来自:https://zhidao.baidu.com/question/1642218015877561100.html

2.执行git命令时出现.git/': SSL certificate problem: self signed certificate的解决办法

SSL证书的问题,可以忽略证书继续重新执行

 在命令端下输入: git config --global http.sslVerify false

3.拉代码时候提示git clone remote: HTTP Basic: Access denied

我是由于第一次输入错误用户名或者密码导致的,参考下面解决:

因为之前输入错误的gitlab用户名和密码,第二次clone不弹框提示输入用户名和密码的解决方案。

打开凭据管理器 - Windows凭据,找到对应的凭据,删除掉,重新clone,就会弹框
提示用户名和密码

https://www.jianshu.com/p/08068ebe5f84

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值