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

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

gitlab on 打工人日志

CI/CD 可观察性-基于grafana sonarqube docker安装和配置 Git 规则 git版本控制 CICD 概念 git使用方法 Jenkins 安装与使用 gitlab与github同步项目 git技巧 gitlab CI/CD 的使用
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 分别设置成这两个域名(注意不要颠倒顺序)。

测试连接