github相关
# 使用SSH拉取代码
# 步骤
# 1.登录用户生成sshKey
git config --global user.name "xxx"
git config --global user.email "xxxxxxx@qq.com"
1
2
2
查看自己的名字:git config user.name
、git config user.email
# 2.把Key填到GitHub上
- 登录GitHub
Setting
→SSH and GPG keys
→SSH keys
填上即可
# 3.使用SSH拉取代码等操作
1、手动
git clone 粘贴的ssh路径
1
2、修改IDEA配置,使用SSH拉取代码
# 替换github访问端口
!!! 报错提示:
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
1
2
3
2
3
上面的错误说明的是:22号端口不行。那如果22号端口不行,咱们就换一个端口
# 操作方法:
1.进入~/.ssh下
cd ~/.ssh
2.创建一个config文件
vim config
3.编辑文件内容:
Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
4.保存退出
5.检查是否成功 ssh -T git@github.com 这里要根据它的提示操作,有个地方要输入yes
$ ssh -T git@github.com
The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:2: github.com
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
Hi 某某人! You've successfully authenticated, but GitHub does not provide shell access.
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8