---
title: "开发问题记录"
canonical_url: "https://wwlight.vercel.app/guides/notes/dev-qa"
---
# 开发问题记录

## 电脑 SSH 配置管理多个远程仓库

<steps level="4">

#### 为账户生成独立的 `SSH` 密钥

本地调用私钥时默认使用 id_rsa，针对于自定义名称的，需要编写 config 文件。

<tabs sync="pkg">
<tabs-item label="ed25519">

```bash
ssh-keygen -t ed25519 -C "personal@email.com" -f ~/.ssh/id_ed25519_github
```

- `-t ed25519`：指定密钥类型为 `Ed25519（椭圆曲线算法）`
- 更安全（抗量子计算攻击）
- 密钥更短但安全性相当（256 位 vs RSA 4096 位）
- 生成更快，签名验证更快

</tabs-item>

<tabs-item label="rsa">

```bash
ssh-keygen -t rsa -b 4096 -C "personal@email.com" -f ~/.ssh/id_rsa_github
```

- `-t rsa`：指定密钥类型为 `RSA`
- `-b 4096`：指定密钥长度为 4096 位（更安全）
- `-C`：添加注释（通常用邮箱标识）
- `-f`：指定密钥文件保存路径

</tabs-item>
</tabs>

#### 配置 `config` 文件

```bash
nano ~/.ssh/config
```

<tabs sync="pkg">
<tabs-item label="ed25519">

```ssh
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_github
IdentitiesOnly yes
```

</tabs-item>

<tabs-item label="rsa">

```ssh
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_github
IdentitiesOnly yes
```

</tabs-item>
</tabs>

#### 添加公钥到各平台

```bash
cat ~/.ssh/id_ed25519_github.pub
```

<tabs>
<tabs-item label="GitHub">

```txt
Settings → SSH and GPG keys
```

</tabs-item>

<tabs-item label="GitLab">

```txt
Preferences → SSH Keys
```

</tabs-item>
</tabs>

#### 测试 SSH 连接

```bash
ssh -T git@github.com
```

</steps>

## ping 和 telnet 对比

<warning>

出于安全考虑，现在很多服务器都会禁用 telnet，转而使用更安全的 SSH 协议。而 ping 则因为是基础网络诊断工具，使用仍然很普遍。

</warning>

<tabs>
<tabs-item label="ping">

```txt
1. 测试网络连接是否正常 - 通过发送 ICMP 数据包到目标主机并等待响应
2. 测量网络延迟 - 可以看到数据包往返时间 (RTT)
3. 检测主机是否在线 - 如果能收到响应，说明目标主机处于运行状态
4. 排查网络故障 - 可以帮助定位网络中断或延迟的位置
```

```bash
ping baidu.com
```

</tabs-item>

<tabs-item label="telnet">

```txt
1. 远程登录 - 可以远程连接到其他计算机并进行操作
2. 测试端口连通性 - 可以用来测试特定端口是否开放
3. 调试网络服务 - 可以直接与运行在特定端口上的服务进行交互
4. 排查应用层协议问题 - 因为可以直接发送原始命令，所以适合调试像 HTTP、SMTP 等协议
```

```bash
brew install telnet
telnet baidu.com 80
```

</tabs-item>
</tabs>

## cmd 下提示 "系统提示找不到路径"

- 首先 `win + R` 打开运行，输入 `regedit` 命令，打开注册表
- 找到 `计算机\HKEY_CURRENT_USER\Software\Microsoft\Command Processor` 路径下 `Autorun` 注册表项，删除即可。

## 隐藏 powershell/cmd 启动提示信息

- 在 `powershell` 目标路径后追加 `-NoLogo` 或者 `-nologo`
- 在 `cmd` 目标路径后追加 `-NoLogo /k` 或者 `-nologo /k`

## 限制控制台打印

```js
const _log = console.log
console.log = () => void 0

const _warn = console.warn
console.warn = () => void 0
```

## 控制台网络请求筛选

### 过滤多个类型

```md
-/.*.b3dm|.*.json|.*.png/
```

### 过滤指定域名

```md
domain:*.baidu.com
```


## Sitemap

See the full [sitemap](https://wwlight.vercel.app/sitemap.md) for all pages.
