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

推荐订阅源

W
WeLiveSecurity
T
Tenable Blog
Project Zero
Project Zero
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
S
Schneier on Security
Scott Helme
Scott Helme
S
Securelist
Know Your Adversary
Know Your Adversary
Vercel News
Vercel News
IT之家
IT之家
V
V2EX
F
Fortinet All Blogs
Simon Willison's Weblog
Simon Willison's Weblog
K
Kaspersky official blog
博客园_首页
T
Tailwind CSS Blog
The GitHub Blog
The GitHub Blog
Spread Privacy
Spread Privacy
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
有赞技术团队
有赞技术团队
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
The Hacker News
The Hacker News
L
LINUX DO - 热门话题
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CXSECURITY Database RSS Feed - CXSecurity.com
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
S
SegmentFault 最新的问题
AWS News Blog
AWS News Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost

git入门系列 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 git入门系列 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 分别设置成这两个域名(注意不要颠倒顺序)。

测试连接