开发问题记录
电脑 SSH 配置管理多个远程仓库
Section titled “电脑 SSH 配置管理多个远程仓库”-
为账户生成独立的
SSH
密钥Terminal window ssh-keygen -t ed25519 -C "personal@email.com" -f ~/.ssh/id_ed25519_github-t ed25519
:指定密钥类型为Ed25519(椭圆曲线算法)
- 更安全(抗量子计算攻击)
- 密钥更短但安全性相当(256 位 vs RSA 4096 位)
- 生成更快,签名验证更快
Terminal window ssh-keygen -t rsa -b 4096 -C "personal@email.com" -f ~/.ssh/id_rsa_github-t rsa
:指定密钥类型为RSA
-b 4096
:指定密钥长度为 4096 位(更安全)-C
:添加注释(通常用邮箱标识)-f
:指定密钥文件保存路径
-
配置
config
文件本地调用私钥时默认使用 id_rsa,针对于自定义名称的,需要编写 config 文件,告诉本地调用哪个私钥。
Terminal window nano ~/.ssh/config~/.ssh/config Host github.comHostName github.comUser gitIdentityFile ~/.ssh/id_ed25519_githubIdentitiesOnly yes~/.ssh/config Host github.comHostName github.comUser gitIdentityFile ~/.ssh/id_rsa_githubIdentitiesOnly yes -
添加公钥到各平台
Terminal window cat ~/.ssh/id_ed25519_github.pubSettings → SSH and GPG keysPreferences → SSH Keys -
测试 SSH 连接
Terminal window ssh -T git@github.com
ping 和 telnet 对比
Section titled “ping 和 telnet 对比”1. 测试网络连接是否正常 - 通过发送 ICMP 数据包到目标主机并等待响应2. 测量网络延迟 - 可以看到数据包往返时间 (RTT)3. 检测主机是否在线 - 如果能收到响应,说明目标主机处于运行状态4. 排查网络故障 - 可以帮助定位网络中断或延迟的位置
ping baidu.com
1. 远程登录 - 可以远程连接到其他计算机并进行操作2. 测试端口连通性 - 可以用来测试特定端口是否开放3. 调试网络服务 - 可以直接与运行在特定端口上的服务进行交互4. 排查应用层协议问题 - 因为可以直接发送原始命令,所以适合调试像 HTTP、SMTP 等协议
brew install telnettelnet baidu.com 80
cmd 下提示 “系统提示找不到路径”
Section titled “cmd 下提示 “系统提示找不到路径””- 首先
win + R
打开运行,输入regedit
命令,打开注册表 - 找到
计算机\HKEY_CURRENT_USER\Software\Microsoft\Command Processor
路径下Autorun
注册表项,删除即可。
隐藏 powershell/cmd 启动提示信息
Section titled “隐藏 powershell/cmd 启动提示信息”- 在
powershell
目标路径后追加-nologo
- 在
cmd
目标路径后追加-nologo /k