惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
B
Blog
The Register - Security
The Register - Security
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
F
Full Disclosure
The GitHub Blog
The GitHub Blog
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
美团技术团队
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
D
DataBreaches.Net
Martin Fowler
Martin Fowler
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
The Cloudflare Blog
博客园 - 【当耐特】
U
Unit 42
月光博客
月光博客
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
博客园 - 聂微东
I
InfoQ
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
Cyberwarzone
Cyberwarzone
V
V2EX
S
Securelist
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Security @ Cisco Blogs
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Heimdal Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tor Project blog

gitlab on 打工人日志

CI/CD 可观察性-基于grafana sonarqube docker安装和配置 ansible 命令 Git 规则 git版本控制 CICD 概念 git使用方法 Jenkins 安装与使用 Gitlab批量导出用户 ansible 安装和部署 gitlab与github同步项目 git技巧 gitlab CI/CD 的使用 Markdown教程
SSH 通过 443 端口连接 GitHub
2023-09-27 · via gitlab on 打工人日志

背景

GitHub 提供了两种协议供用户使用 Git 连接—— SSH 和 HTTPS。理论上我可以随意选择两者之一连接到我在 GitHub 上的代码仓库,无论是将云端的仓库 clone 到本地,还是将本地的修改 push 到云端。然而,出于一些奇奇怪怪的原因,我所在的办公网络环境禁止了 22 端口,而 22 端口正是 GitHub 提供 SSH 访问的端口号。尽管可以换用 HTTPS 协议,但无论如何将我电脑上的所有代码仓库的上游都从 git@github.com:... 修改称 https://github.com/... 仍然是一个繁重的体力活。

解决

为了让Git也能通过上述端口用 SSH 访问 GitHub,我们为上述 SSH 连接方式设置一个别名。首先找到SSH的配置文件,它的路径一般是~/.ssh/config,如果这个文件不存在的话也可以创建一个。然后,在其中增加以下内容:

1Host github.com
2  HostName ssh.github.com
3  User git
4  Port 443

其中,Host 是别名,HostName 是实际的域名地址,Port 是端口号。因为我希望当我在用 SSH 连接 github.com 时,实际访问的是 ssh.github.com,所以 Host 和 HostName 分别设置成这两个域名(注意不要颠倒顺序)。

测试连接