GitLab(Git)生成与添加密钥

生成密钥

ED25519 SSH keys

更加安全的新密钥

ssh-keygen -t ed25519 -C "<comment>"

-C后面可以跟email邮箱作为label

Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/user/.ssh/id_ed25519):

RSA SSH keys

使用2048bits

ssh-keygen -t rsa -b 2048 -C "email@example.com"

-C后面可以跟email邮箱

Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):

添加密钥

首先保证已经创建好了密钥

使用不同的方式打开文件,能看到文件内容就行

macOS:

pbcopy < ~/.ssh/id_ed25519.pub

Linux (requires the xclip package):

xclip -sel clip < ~/.ssh/id_ed25519.pub

Git Bash on Windows:

cat ~/.ssh/id_ed25519.pub | clip

复制添加

SSL certificate problem: self signed certificate

问题原因:没有正确的SSL证书

解决方法:

1、定义全局git repo

export GIT_SSL_NO_VERIFY=true

2、关闭SSL检查

git config --global http.sslVerify false
posted @ 2023-01-13 15:48  Lian_tiam  阅读(936)  评论(0)    收藏  举报