Gitlab项目管理

SSH协议 SSH密钥

md .ssh
兼容问题

ssh-keygen -t ed25519 -C “email@example.com
ssh-keygen -o -t rsa -b 4096 -C “email@example.com

1
2
3
4
5
6
7
8
cat ~/.ssh/id_ed25519.pub | clip

git config --list
git config --global --unset user.name
git config --global --unset user.email
#如要在repo中使用 user1 进行操作,进入repo目录后,先设置username 和 email,再进行其他操作
git config user.name "user1"
git config user.email "user1@xx.mail"

添加密钥

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
eval "$(ssh-agent -s)"

$ ssh-add ~/.ssh/id_rsa
$ ssh-add -l
$ ssh-add -d
$ ssh-add -D

## 配置地址信息
Host GitLab
HostName 127.0.0.1
Port 2222
Preferredauthentications publickey
IdentityFile ~/.ssh/fsh_rsa

Host github
HostName github.com
Preferredauthentications publickey
IdentityFile ~/.ssh/id_rsa

#如果是在本地ip而且不是默认端口22 则需要带端口号
ssh -T git@gitlab.com