Tianyi's Blog Tianyi's Blog
首页
  • 计算机网络
  • 操作系统
  • 计算机科学
  • Nginx
  • Vue框架
  • 环境配置
  • Java
  • JVM
  • Spring框架
  • Redis
  • MySQL
  • RabbitMQ
  • Kafka
  • Mirror Sites
  • Dev Tools
  • Docker
  • Jenkins
  • Scripts
  • Windows
  • 科学上网
  • 旅行
  • 网站日记
  • 软件
  • 电子产品
  • 杂野
  • 分类
  • 友情链接
GitHub (opens new window)

Tianyi

一直向前,永不停止
首页
  • 计算机网络
  • 操作系统
  • 计算机科学
  • Nginx
  • Vue框架
  • 环境配置
  • Java
  • JVM
  • Spring框架
  • Redis
  • MySQL
  • RabbitMQ
  • Kafka
  • Mirror Sites
  • Dev Tools
  • Docker
  • Jenkins
  • Scripts
  • Windows
  • 科学上网
  • 旅行
  • 网站日记
  • 软件
  • 电子产品
  • 杂野
  • 分类
  • 友情链接
GitHub (opens new window)
  • 镜像站

  • 环境

  • Docker

  • 工具

    • 环境配置
    • 从零开始的 WSL 之旅:从安装到配置
    • Version Control(git)
    • dot-files
    • 开发工具Maven
    • github相关
      • 使用SSH拉取代码
        • 步骤
        • 1.登录用户生成sshKey
        • 2.把Key填到GitHub上
        • 3.使用SSH拉取代码等操作
      • 替换github访问端口
        • 操作方法:
  • Linux

  • 新知

  • Jenkins

  • Consul_服务注册发现

  • SHELL

  • 项目

  • 运维
  • 工具
tianyi
2024-01-27
目录

github相关

# 使用SSH拉取代码

# 步骤

# 1.登录用户生成sshKey

git config --global user.name "xxx"
git config --global user.email "xxxxxxx@qq.com"
1
2

查看自己的名字:git config user.name、git config user.email

# 2.把Key填到GitHub上

  1. 登录GitHub
  2. 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

上面的错误说明的是: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

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
完善页面 (opens new window)
开发工具Maven
linux1

← 开发工具Maven linux1→

最近更新
01
JDK
02-23
02
BadTasteCode && 优化
09-11
03
Gradle 实践操作指南及最佳实践
09-11
更多文章>
Theme by Vdoing | Copyright © 2021-2025 Tandy | 粤ICP备2023113440号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式